Skip to main content

Configuration

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

Pass these options to AsgardeoAuthClient.initialize(). The configuration type is AuthClientConfig<T>, where T holds any extra fields your integration adds. The framework and platform SDKs map their own configuration onto these options.

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

Required options​

OptionTypeDescription
afterSignInUrlstringWhere WSO2 Identity Server redirects the user after sign-in. It must match an authorized redirect URL of the application. Sent as redirect_uri.
clientIdstringThe client ID of the application you registered in WSO2 Identity Server.

You also need one of baseUrl, wellKnownEndpoint or a complete endpoints object, so the client can find the WSO2 Identity Server endpoints. See How endpoints are resolved.

Endpoint options​

OptionTypeDescription
baseUrlstringThe base URL of your WSO2 Identity Server organization, for example https://localhost:9443.
wellKnownEndpointstringThe URL of the OpenID Connect discovery document. When set, the client reads the endpoints from it.
endpointsobjectEndpoint URLs that override the resolved ones.

How endpoints are resolved​

The client resolves the endpoints once, the first time it needs one, and saves them to the store:

  1. If wellKnownEndpoint is set, the client fetches the discovery document from it.

  2. Otherwise, if baseUrl is set, the client builds the endpoints from it without a network call:

    EndpointURL
    Authorization<baseUrl>/oauth2/authorize
    Token<baseUrl>/oauth2/token
    Issuer<baseUrl>/oauth2/token
    JWKS<baseUrl>/oauth2/jwks
    User info<baseUrl>/oauth2/userinfo
    Revocation<baseUrl>/oauth2/revoke
    End session<baseUrl>/oidc/logout
    Check session iframe<baseUrl>/oidc/checksession
  3. Otherwise, the client uses the endpoints option, which must then contain all eight endpoints.

In every case, the values in endpoints take precedence. Use the short key names, or the OpenID Connect discovery field names in camel case (the client converts those to snake case):

KeyCamel case discovery nameDiscovery field
authorizationauthorizationEndpointauthorization_endpoint
tokentokenEndpointtoken_endpoint
endSessionendSessionEndpointend_session_endpoint
jwksjwksUrijwks_uri
revocationrevocationEndpointrevocation_endpoint
userInfouserinfoEndpointuserinfo_endpoint
introspectionintrospectionEndpointintrospection_endpoint
checkSessioncheckSessionIframecheck_session_iframe
issuerissuerissuer

Optional options​

OptionTypeDefaultDescription
afterSignOutUrlstring—Where WSO2 Identity Server redirects the user after sign-out. When not set, the client uses afterSignInUrl. It must match an authorized redirect URL of the application.
clientSecretstring—The client secret, for confidential clients such as server-side apps. The client sends it in token, refresh and revocation requests. Don't use it in public clients such as browser apps.
scopesstring | string[]"openid profile internal_login"The scopes to request, as an array or a space-separated string. The default applies only when no scopes are set; scopes you set are sent as they are.
enablePKCEbooleantrueUse PKCE (S256) in the authorization code flow.
responseMode"query" | "form_post" | "direct""query"How WSO2 Identity Server returns the authorization code. Sent as response_mode.
promptstring—The OpenID Connect prompt parameter, for example login to always show the login page.
sendCookiesInRequestsbooleantrueSend cookies with the token, refresh, revocation, custom grant and JWKS requests (credentials: "include"). When false, the client uses credentials: "same-origin".
sendIdTokenInLogoutRequestboolean—Send the ID token as id_token_hint in the sign-out URL. When not set, the sign-out URL carries client_id instead.
tokenRequest.authMethod"client_secret_basic" | "client_secret_post" | "none"—How the client authenticates at the token endpoint during the code exchange when clientSecret is set. When not set, the client uses client_secret_basic if platform is AsgardeoV2, and client_secret_post otherwise. With none, no secret is sent.
tokenValidation.idToken.validatebooleantrueValidate the ID token's signature and claims after each token request.
tokenValidation.idToken.validateIssuerbooleantrueCheck the ID token's iss claim against the issuer.
tokenValidation.idToken.clockTolerancenumber300Allowed clock skew, in seconds, when validating the ID token.
applicationIdstring—The UUID of the application in WSO2 Identity Server. The client saves it to the store, and keeps using the saved value when a later initialize() call leaves it out.
platformPlatform—The platform the client connects to: Platform.Asgardeo, Platform.IdentityServer, Platform.AsgardeoV2 or Platform.Unknown.
organizationChain.sourceInstanceIdnumber—The instance ID of another client whose access token the exchangeToken() placeholders read. Used to exchange a token from one organization for a token in another.
organizationChain.targetOrganizationIdstring—The organization to exchange the token for. Read by framework SDKs together with sourceInstanceId.

The tokenValidation options are merged with their defaults, so you can set only the ones you want to change. For example, tokenValidation: { idToken: { clockTolerance: 60 } } keeps validation on.

Was this page helpful?