keycloak-redirect
v1.2.5
Published
keycloak redirect browserify
Downloads
24
Readme
keycloakjs-redirect
Use case
A Frontend Javascript service that integrates with the Keycloak authentication service, guiding users to a login portal when a 401 Unauthorised response is received from an API.
Install
$ npm i keycloak-redirect
Configuration
Import the package, then use the object exposed to return the function authenticate
, passing in all mandatory arguments: a config object, a XMLHttpRequest object, and window.
import keycloakRedirect from 'keycloak-redirect';
var config = {
backend: "http://yourBackendUrl.com",
clientId: "yourClientId",
keycloakUrl: "http://yourKeycloakUrl.com"
};
keycloakRedirect.authenticate(config, new XMLHttpRequest(), $window);
Run Tests
$ npm test
Compile the code with babel
$ npm run compile