Wondering what’s next for npm?Check out our public roadmap! »

cloudentity-js-auth

1.0.0-beta.2 • Public • Published

Cloudentity Web Auth

Cloudentity Web Auth client for Javascript Single Page Apps.

Import

Script tag

<script src="cloudentity-web-auth.js"></script>

Node.js style

const CloudentityWebAuth = require('cloudentity-js-auth');

ES6 import

import CloudentityWebAuth from 'cloudentity-js-auth';

Usage

  1. First – create and configure CloudentityWebAuth:

     var cloudentity = new CloudentityWebAuth({
         domain: 'your-cloudentity-domain',
         tenantId: 'your-tenant-id',
         authorizationServerId: 'your-authorization-server-id',
         clientId: 'your-client-id',
         redirectUri: 'window.location.href',
         scopes: ['profile', 'email', 'openid', 'revoke_tokens']
     });
    
  2. To check if there's an OAuth response in URL hash and parse it:

     cloudentity.getAuth().then(
       function (authResponse) {
         // use OAuth data, clean hash string, etc.
       },
    
       function (errorResponse) {
         // we're not authorized
       }
     );
    
  3. If not (e.g. this is the initial app load), to initialize OAuth2 PKCE flow:

     cloudentity.authorize(); // redirects to authorization service
    

Keywords

none

Install

npm i cloudentity-js-auth

DownloadsWeekly Downloads

7

Version

1.0.0-beta.2

License

none

Unpacked Size

60.8 kB

Total Files

5

Last publish

Collaborators

  • avatar