@authkitcom/core
v1.0.17
Published
Core javascript AuthKit library
Downloads
60
Readme
AuthKit Javascript
Overview
The AuthKit core JavaScript library.
Install
NPM:
npm install --save @authkitcom/core
Yarn:
yarn add @authkitcom/core
Basic Usage
To use the library, create and AuthKit object and call the authorize method. If the user is not authenticated, they will be redirected to the authorize endpoint first.
import { createAuthKitForDOM } from '@authkitcom/core';
const authKit = createAuthKitForDOM({
clientId: '9cc49356433b89a1bf244dd00cb34523',
issuer: 'https://mytenant.authkit.com',
scope: ['email', 'profile', 'openid'],
redirectHandler: (uri: string) {
window.location.href = uri;
}
});
// Authorize
const auth = await authkit.authorize();
const accessToken = await auth.getTokens().accessToken;