@madappgang/identifo-js

2.0.2 • Public • Published

IdentifoJS

Browser library for authentication through Identifo.

Install

$ npm install @madappgang/identifo-js

Usage

The pacakge exports the only function that will initialize identifo client.

  import initIdentifo from '@madappgang/identifo-js';

  const options = {
    authServerURI: 'http://localhost:8080', // URI of your Identifo server.
    appId: '59fd884d8f6b180001f5b4e3', // ID of application that you want to get access to.
    scopes: ['chat'], // Scopes that you want to request.
    callbackURL: 'http://localhost:3000/callback', // URL that you will be redirected to after a successful login.
  };

  const identifo = initIdentifo(options);

Methods

  • identifo.login redirects user to the login page
  • identifo.handleAuthentication parses token from url, you should call it when you are at callback_url.
  const { body, token } = identifo.handleAuthentication();
  • identifo.renewSession obtains a new access token for a user who already has established SSO session.
  identifo.renewSession()
    .then(({ token, body }) => { });
    .catch(() => identifo.login()) // If there's an error you should try to login, probably user hasn't established SSO session.
  • identifo.register redirects user to the registration page.
  • identifo.logout removes SSO session.

Readme

Keywords

Package Sidebar

Install

npm i @madappgang/identifo-js

Weekly Downloads

0

Version

2.0.2

License

MIT

Unpacked Size

320 kB

Total Files

7

Last publish

Collaborators

  • jackrudenko
  • msalabutin
  • dprovodnikov