Skip to main content

Configuration

Cloud has the newest features. Some may not be in a release yet; the newest release is Identity & Access Management 7.3.0.

The initialize() method accepts a configuration object (AuthClientConfig) that controls how the SDK connects to your Choreo Identity & Access Management instance and manages authentication.

Basic Configuration​

import ThunderIDJavaScriptClient from "@thunderid/javascript"

const client = new ThunderIDJavaScriptClient()

await client.initialize({
clientId: '<your-client-id>',
baseUrl: 'https://<DATA_PLANE_URL>',
})

Configuration Reference​

Required Parameters​

ParameterTypeDescription
baseUrlstringBase URL of the Choreo Identity & Access Management instance (e.g., https://<DATA_PLANE_URL>)
clientIdstringClient ID from your Choreo Identity & Access Management application registration

Authentication Parameters​

ParameterTypeDefaultDescription
afterSignInUrlstring-URL to redirect to after a successful sign-in. Must match an allowed redirect URI in your IdP
afterSignOutUrlstring-URL to redirect to after sign-out. Must match an allowed post-logout redirect URI
scopesstring | string[]['openid']OAuth 2.0 scopes to request. Accepts a space-separated string or an array
clientSecretstring-Client secret. Only required for confidential clients. Do not use in browser applications
enablePKCEbooleantrueEnable PKCE (RFC 7636). Disable only if your authorization server does not support it
promptstring-Controls the authentication UI behavior (e.g., "login", "none", "consent")
responseModestring'query'OAuth 2.0 response mode for the authorization request
sendCookiesInRequestsbooleantrueInclude cookies in token, refresh-token, and custom-grant requests
sendIdTokenInLogoutRequestboolean-Include id_token_hint in the logout request to the end-session endpoint
mode'redirect' | 'embedded''redirect'Authentication interaction mode. Use 'embedded' for app-native flows
signInOptionsRecord<string, any>-Additional query parameters to include in every authorization request
signInUrlstring-Override the sign-in page URL. Defaults to the Choreo Identity & Access Management hosted login page
signOutOptionsRecord<string, unknown>-Additional parameters to include in the sign-out request
signUpOptionsRecord<string, unknown>-Additional parameters to include in the sign-up request
signUpUrlstring-Override the sign-up page URL

Token Parameters​

ParameterTypeDefaultDescription
tokenRequest.authMethod'client_secret_basic' | 'client_secret_post' | 'none'Platform defaultClient authentication method used at the token endpoint
tokenValidation.idToken.validatebooleantrueWhether to validate ID tokens
tokenValidation.idToken.validateIssuerbooleantrueWhether to validate the iss claim in ID tokens
tokenValidation.idToken.clockTolerancenumber300Allowed clock skew in seconds when validating token expiry
tokenLifecycle.refreshToken.autoRefreshboolean-Automatically refresh the access token before it expires

Session Parameters​

ParameterTypeDefaultDescription
storageTPlatform defaultStorage backend for session and config data. The accepted values depend on the platform SDK
session.silentSignIn.beforeRedirectbooleanfalseBrowser SDKs only. Before signIn() redirects, try a silent prompt=none sign-in from the existing Choreo Identity & Access Management session. When the session exists, the user is signed in without leaving the app. Otherwise the redirect continues. Skipped when the sign-in options set their own prompt
session.silentSignIn.timeoutnumber10000How long, in milliseconds, a silent sign-in waits for a response before treating the user as signed out. Also applies to signInSilently()
instanceIdnumber0Instance identifier for namespacing storage. Use when running multiple SDK instances

Discovery and Endpoint Parameters​

By default the SDK fetches {baseUrl}/.well-known/openid-configuration to resolve endpoint URLs.

ParameterTypeDefaultDescription
discovery.wellKnown.enabledbooleantrueWhether to use the well-known discovery document to resolve endpoints
endpoints.wellKnownstring{baseUrl}/.well-known/openid-configurationOverride the discovery document URL
endpoints.authorizationstring-Override the authorization endpoint
endpoints.tokenstring-Override the token endpoint
endpoints.endSessionstring-Override the end-session (logout) endpoint
endpoints.userInfostring-Override the userinfo endpoint
endpoints.jwksstring-Override the JWKS endpoint
endpoints.introspectionstring-Override the token introspection endpoint
endpoints.flowExecutestring{baseUrl}/flow/executeOverride the flow execution endpoint (embedded sign-in, sign-up, recovery, and user onboarding flows)
endpoints.flowMetastring{baseUrl}/flow/metaOverride the flow metadata endpoint
endpoints.usersMestring{baseUrl}/users/meOverride the current-user profile endpoint
endpoints.applicationsstring{baseUrl}/applicationsOverride the applications collection used by the management operations
endpoints.usersstring{baseUrl}/usersOverride the users collection used by the management operations
endpoints.agentsstring{baseUrl}/agentsOverride the agents collection used by the management operations

The endpoints.authorization, endpoints.token, endpoints.userInfo, endpoints.jwks, endpoints.introspection, and endpoints.endSession overrides address OIDC/OAuth endpoints, which are otherwise resolved from the discovery document. The endpoints.flowExecute, endpoints.flowMeta, endpoints.usersMe, endpoints.applications, endpoints.users, and endpoints.agents overrides address resource-server endpoints, which are otherwise derived by concatenating baseUrl with a fixed path.

Split these two groups when the OAuth authorization server and the Choreo Identity & Access Management resource server are different hosts, for example when two Choreo Identity & Access Management instances are connected as trusted issuers. Point baseUrl (and hence the OAuth/discovery endpoints) at the authorization server, and override the resource-server endpoints to target the resource server that owns the users and flows:

{
baseUrl: 'https://idp.example.com',
endpoints: {
flowExecute: 'https://rs.example.com/flow/execute',
flowMeta: 'https://rs.example.com/flow/meta',
usersMe: 'https://rs.example.com/users/me',
},
}

Application Parameters​

ParameterTypeDefaultDescription
applicationIdstring-UUID of the Choreo Identity & Access Management application. Used for Application Branding and sign-up flow access URLs
allowedExternalUrlsstring[]-URL prefixes the SDK may attach access tokens to when making HTTP requests. Only applies when using the webWorker storage type

Preferences​

The preferences object customizes UI behavior for SDKs that render built-in components (React SDK, Browser SDK).

Theme Preferences (preferences.theme)​

PropertyTypeDefaultDescription
inheritFromBrandingbooleanfalseFetch and apply branding from the Choreo Identity & Access Management server
mode'light' | 'dark' | 'system''system'Theme mode. 'system' follows the OS preference
overridesRecursivePartial<ThemeConfig>{}Custom theme overrides for colors, typography, and spacing
direction'ltr' | 'rtl''ltr'Text direction for UI components

Internationalization Preferences (preferences.i18n)​

PropertyTypeDefaultDescription
languagestringBrowser defaultHard override for the UI language (e.g., 'en-US', 'fr-FR'). Bypasses all other language detection
fallbackLanguagestring'en-US'Fallback language when translations are not available
bundlesRecord<string, I18nBundle>{}Custom translation bundles to override default text
storageStrategy'cookie' | 'localStorage' | 'none''cookie'How to persist the user's language selection
storageKeystring'thunderid-i18n-language'Key name for reading/writing the language to storage
cookieDomainstringDerived from hostnameDomain for the language cookie. Override for eTLD+1 domains
urlParamstring | false'lang'URL query parameter to inspect for a language override. Set to false to disable

User Preferences (preferences.user)​

PropertyTypeDefaultDescription
fetchUserProfilebooleantrueAutomatically fetch the full user profile after sign-in. When false, only ID token claims are available

Full Example​

src/auth.ts
import ThunderIDJavaScriptClient from "@thunderid/javascript"

const client = new ThunderIDJavaScriptClient()

await client.initialize({
clientId: '<your-client-id>',
baseUrl: 'https://<DATA_PLANE_URL>',
afterSignInUrl: 'http://localhost:3000',
afterSignOutUrl: 'http://localhost:3000',
scopes: ['openid', 'profile', 'email', 'internal_login'],
enablePKCE: true,
tokenValidation: {
idToken: {
validate: true,
validateIssuer: true,
clockTolerance: 300,
},
},
preferences: {
theme: {
inheritFromBranding: true,
mode: 'system',
},
i18n: {
language: 'en-US',
fallbackLanguage: 'en-US',
},
},
})

export default client

Was this page helpful?