This repository contains examples for using the Cloudentity Auth JS library (@cloudentity/auth
on NPM or Yarn) used to facilitate authentication with Cloudentity.
Setting up authentication for your application couldn’t been easier and only requires these simple steps below.
Try it out using the Cloudentity demo. After starting your trial, create your JS Single Page App in the Cloudentity developer self service and follow the steps there to see how easy it is.
To play with each example project:
-
Go to it's directory and install all dependencies:
npm install
-
Update
settings.js
file with your Cloudentity domain and client id:var CLOUDENTITY_SETTINGS = { domain: 'your-domain', // e.g. 'example.demo.cloudentity.com' tenantId: 'your-tenant-id', authorizationServerId: 'your-authorization-server-id', clientId: 'your-client-id', redirectUri: 'http://localhost:8000', scopes: ['profile', 'email', 'openid', 'revoke_tokens'] // 'revoke_tokens' scope must be present for 'logout' action to revoke token! Without it, token will only be deleted from browser's local storage. };
-
Make sure you have
http://localhost:8000
added to your Redirect URLs in Application Settings. -
Start example server:
npm start
-
Open following URL in your browser:
http://localhost:8000
Check out the NPM page for the @cloudentity/auth
library for info on all available features:
https://www.npmjs.com/package/@cloudentity/auth