Strivacity JavaScript SDK client

Install

npm install @strivacity/sdk-core

Usage

import { initFlow } from '@strivacity/sdk-core';

const sdk = initFlow({
	issuer: 'https://<YOUR_DOMAIN>',
	scopes: ['openid', 'profile'],
	clientId: '<YOUR_CLIENT_ID>',
	redirectUri: '<YOUR_REDIRECT_URI>',
});

await sdk.login();

API documentation

initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' }): PopupFlow | RedirectFlow

The initFlow function initializes and returns an instance of either PopupFlow or RedirectFlow, based on the specified mode.

Parameters:

  • options: An object containing configuration options for the SDK.

Type:

SDKOptions & { mode?: 'popup' | 'redirect' }

Properties:

issuer (string): The issuer URL of the OpenID Provider.
clientId (string): The client identifier for the application.
redirectUri (string): The URI to redirect to after authentication.
scopes (Array): The scopes to request during authentication.
responseType (ResponseType): The response type requested from the OpenID Provider.
responseMode (ResponseMode): The response mode to use.
storageTokenName (string): The name of the token in storage.
storage (SDKStorageType): A custom storage implementation.

Mode:

popup: Uses a popup window for authentication. Returns an instance of PopupFlow.
redirect: Uses a full-page redirect for authentication. Returns an instance of RedirectFlow.

Links

Example app