Skip to main content

Configuration

You're reading Identity & Access Management 7.0.0. The newest release is 7.3.0, and Cloud has the newest features. Go to the newest release

Pass these options to AsgardeoSPAClient.initialize().

import { AsgardeoSPAClient } from "@asgardeo/browser";

const auth = AsgardeoSPAClient.getInstance();

await auth.initialize({
afterSignInUrl: "http://localhost:5173",
afterSignOutUrl: "http://localhost:5173",
clientId: "<your-app-client-id>",
baseUrl: "https://localhost:9443"
});

Required options​

OptionTypeDescription
baseUrlstringThe base URL of your WSO2 Identity Server organization, for example https://localhost:9443.
clientIdstringThe client ID of the application you registered in WSO2 Identity Server.
afterSignInUrlstringWhere WSO2 Identity Server redirects the user after sign-in. It must match an authorized redirect URL of the application.

Optional options​

OptionTypeDefaultDescription
afterSignOutUrlstring—Where WSO2 Identity Server redirects the user after sign-out. It must match an authorized redirect URL of the application.
scopesstring[]["openid", "profile", "internal_login"]The scopes to request.
storage"sessionStorage" | "localStorage" | "browserMemory" | "webWorker""sessionStorage"Where the session is stored. With webWorker, tokens stay inside a web worker and are not readable by your app's code; call APIs with httpRequest().
enablePKCEbooleantrueUse PKCE in the authorization code flow.
responseMode"query" | "form_post""query"How WSO2 Identity Server returns the authorization code.
promptstring—The OpenID Connect prompt parameter, for example login to always show the login page.
allowedExternalUrlsstring[]—URLs other than baseUrl that httpRequest() may send the access token to. Applies when storage is webWorker.
periodicTokenRefreshbooleanfalseRefresh the access token before it expires.
autoLogoutOnTokenRefreshErrorbooleanfalseSign the user out when refreshing the access token fails.
syncSessionbooleanfalseKeep the app's session in sync with WSO2 Identity Server using OpenID Connect session management.
checkSessionIntervalnumber3How often, in seconds, to check the session when syncSession is enabled.
sessionRefreshIntervalnumber300How often, in seconds, to refresh the session when syncSession is enabled.
sendCookiesInRequestsbooleantrueSend cookies in requests to WSO2 Identity Server.
sendIdTokenInLogoutRequestboolean—Send the ID token as id_token_hint in the sign-out request.
tokenValidation.idToken.validatebooleantrueValidate the ID token.
tokenValidation.idToken.validateIssuerbooleantrueValidate the issuer of the ID token.
tokenValidation.idToken.clockTolerancenumber300Allowed clock skew, in seconds, when validating the ID token.
endpointsobject—Override individual OpenID Connect endpoints instead of using the ones from the well-known endpoint.
wellKnownEndpointstring—A custom OpenID Connect discovery endpoint.

Was this page helpful?