Skip to main content

Configuration

Pass these options to AsgardeoExpressClient.getInstance().

import { AsgardeoExpressClient } from "@asgardeo/express";

AsgardeoExpressClient.getInstance({
appURL: "http://localhost:3000",
baseUrl: "https://api.asgardeo.io/t/<your-organization-name>",
clientId: "<your-app-client-id>",
clientSecret: "<your-app-client-secret>"
});

Required options​

OptionTypeDescription
appURLstringThe URL your app runs at, without a trailing slash, for example http://localhost:3000. The SDK builds the redirect URLs from it.
baseUrlstringThe base URL of your WSO2 Identity Platform organization, for example https://api.asgardeo.io/t/<your-organization-name>. The SDK builds the OpenID Connect endpoints from it. You can leave it out if you set wellKnownEndpoint or endpoints instead.
clientIdstringThe client ID of the application you registered in WSO2 Identity Platform.
clientSecretstringThe client secret of the application. Express apps are registered as traditional web applications, which authenticate to the token endpoint with the client secret.

Optional options​

OptionTypeDefaultDescription
loginPathstring"/login"The path of the sign-in route. WSO2 Identity Platform also redirects the user back to this path after sign-in, so appURL + loginPath must be an authorized redirect URL of the application.
logoutPathstring"/logout"The path of the sign-out route. WSO2 Identity Platform redirects the user back to this path after sign-out, so appURL + logoutPath must be an authorized redirect URL of the application.
cookieConfigobjectSee Session cookieOptions for the ASGARDEO_SESSION_ID cookie: maxAge, httpOnly, sameSite and secure.
signInConfigobject—Parameters to add to the authorization request. fidp takes the user straight to a specific identity provider's login page, forceInit reloads the OpenID provider metadata, and any other key is sent as a query parameter.
scopesstring | string[]["openid", "profile", "internal_login"]The scopes to request. When you set scopes, the SDK requests only those.
enablePKCEbooleantrueUse PKCE in the authorization code flow.
promptstring—The OpenID Connect prompt parameter, for example login to always show the login page.
tokenRequest.authMethodstring"client_secret_post"How the app authenticates to the token endpoint with its client secret: client_secret_post sends it in the request body and client_secret_basic sends it in the Authorization header.
sendIdTokenInLogoutRequestboolean—Send the ID token as id_token_hint in the sign-out request. Otherwise, the SDK sends client_id.
sendCookiesInRequestsbooleantrueSend cookies in requests to WSO2 Identity Platform.
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, such as authorizationEndpoint, tokenEndpoint and endSessionEndpoint, instead of the ones built from baseUrl.
wellKnownEndpointstring—An OpenID Connect discovery endpoint to read the endpoints from, instead of building them from baseUrl.
note

The SDK sets afterSignInUrl to appURL + loginPath and afterSignOutUrl to appURL + logoutPath, and ignores any values you pass for them. The sign-in route reads the authorization code from the query string, so keep the default response mode.

Was this page helpful?