1.0.1 • Published 7 months ago

@usace/keycloak v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

#Simple Keycloak JS Client

to use, add the keycloak js class to your project and import it into your auth bundle. then in the bundler init function, set keycloak up similar to the code below.

refreshUrl was added to support the use case when a token is requested via CAC, then refreshed on the keycloak server's non-cac route to avoid re-entering PIN numbers.

npm install @usace/keycloak

import Keycloak from "@usace/keycloak"

init:store=>{
    keycloak = new Keycloak({
      keycloakUrl:keycloakHost,
      refreshUrl:keycloakRefresh, //omit if refresh should use keycloakHost
      realm:keycloakRealm,
      client:keycloakClient,
      redirectUrl:keycloakRedirect,
      refreshInterval:300,
      sessionEndWarning:600,
      onAuthenticate:(token)=>{
        store.doAuthUpdate(token);
      },
      onError:(err)=>{
        console.log(err);
        store.doAuthUpdate(null);
      },
      onSessionEnding:(remainingTime)=>{
        console.log(remainingTime);
        store.doAppUpdateNotification(true,"warning",`Your session is expiring in ${Math.round(remainingTime/60)} minutes.`)
      }
    });

    keycloak.checkForSession();
  },

This package is automatically published to NPM when a new release is created. Use npm version to update the version of the package prior to running a new release.

1.0.1

7 months ago

1.0.0

7 months ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.7

2 years ago

0.3.1-beta.1

3 years ago

0.2.1-beta.3

3 years ago

0.3.1-beta.0

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.2.1-beta.2

3 years ago

0.1.2

3 years ago