2.0.2 • Published 5 years ago

@madappgang/identifo-js v2.0.2

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

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.
2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago