Skip to main content

Configuration

The initialize() method accepts a configuration object (AuthClientConfig) that controls how the SDK connects to your ThunderID instance and manages authentication.

Basic Configuration

import ThunderIDJavaScriptClient from '@thunderid/javascript'

const client = new ThunderIDJavaScriptClient()

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

Configuration Reference

Required Parameters

ParameterTypeDescription
baseUrlstringBase URL of the ThunderID instance (e.g., https://localhost:8090)
clientIdstringClient ID from your ThunderID application registration

Authentication Parameters

ParameterTypeDefaultDescription
afterSignInUrlstringURL to redirect to after a successful sign-in. Must match an allowed redirect URI in your IdP
afterSignOutUrlstringURL 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
clientSecretstringClient 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
promptstringControls 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
sendIdTokenInLogoutRequestbooleanInclude 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
signInUrlstringOverride the sign-in page URL. Defaults to the ThunderID 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
signUpUrlstringOverride 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.autoRefreshbooleanAutomatically 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
syncSessionbooleanfalseSync the application session with the IdP using OIDC iframe session management (RFC). May not work in browsers with third-party cookie restrictions
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.authorizationstringOverride the authorization endpoint
endpoints.tokenstringOverride the token endpoint
endpoints.endSessionstringOverride the end-session (logout) endpoint
endpoints.userInfostringOverride the userinfo endpoint
endpoints.jwksstringOverride the JWKS endpoint
endpoints.introspectionstringOverride the token introspection endpoint

Application Parameters

ParameterTypeDefaultDescription
applicationIdstringUUID of the ThunderID 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 ThunderID 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 SCIM2 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://localhost:8090',
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
ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© WSO2 LLC. All rights reserved.Privacy PolicyCookie Policy