@descope/web-js-sdk
Descope JavaScript web SDK - Alpha
Usage
Install the package
npm install @descope/web-js-sdk
Use it
import descopeSdk, { getSessionToken } from '@descope/web-js-sdk';
const myProjectId = 'xxx';
const sdk = descopeSdk({ projectId: myProjectId });
sdk.onSessionTokenChange((newSession, oldSession) => {
});
sdk.onUserChange((newUser, oldUser) => {
});
const userIdentifier = 'identifier';
sdk.otp.signIn.email(userIdentifier);
const sessionToken = getSessionToken();
Run Example
To run the example:
- Clone the repo
- Install dependencies
pnpm i
- Go to package directory
cd packages/web-js-sdk
- Run the sample
pnpm run start
The browser open a tab with directory tree of available examples. Click on the desire directory and follow the instruction.
NOTE: This package is a part of a monorepo. so if you make changes in a dependency, you will have to rerun (this is a temporary solution until we improve the process to fit to monorepo).