ThunderIDNodeConfig
ThunderIDNodeConfig is the configuration type for the ThunderID Node.js SDK. The type extends the base Config from @thunderid/javascript and adds a Node.js-specific option for controlling session cookie lifetime.
Usage
Pass a ThunderIDNodeConfig object to the initialize method of your client:
src/auth.ts
import { ThunderIDNodeConfig } from '@thunderid/node'
const config: ThunderIDNodeConfig = {
clientId: '<your-client-id>',
serverOrigin: 'https://localhost:8090',
afterSignInUrl: 'http://localhost:3000/callback',
afterSignOutUrl: 'http://localhost:3000',
sessionCookieExpiryTime: 28800, // 8 hours
}
Properties
Node.js-Specific Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
sessionCookieExpiryTime | number | ❌ | 86400 (24 hours) | Session cookie lifetime in seconds. Determines how long the session cookie remains valid after sign-in. |
Resolution Order for sessionCookieExpiryTime
The SDK resolves the session cookie expiry time in the following order, using the first defined value:
- The
sessionCookieExpiryTimeproperty in the configuration object. - The
ASGARDEO_SESSION_COOKIE_EXPIRY_TIMEenvironment variable. - The built-in default of
86400seconds (24 hours).
Inherited Base Properties
ThunderIDNodeConfig inherits all properties from the base Config type in @thunderid/javascript. The following table lists the most commonly used inherited properties:
| Property | Type | Required | Description |
|---|---|---|---|
clientId | string | ✅ | The client ID of your application registered in ThunderID. |
serverOrigin | string | ✅ | The base URL of the ThunderID instance (for example, https://localhost:8090). |
afterSignInUrl | string | ❌ | The URL to redirect to after a successful sign-in. |
afterSignOutUrl | string | ❌ | The URL to redirect to after sign-out. |
clientSecret | string | ❌ | The client secret. Required for confidential clients only. |
scope | string[] | ❌ | The OAuth 2.0 scopes to request. Defaults to ['openid', 'profile']. |
Example
import { ThunderIDNodeConfig } from '@thunderid/node'
const config: ThunderIDNodeConfig = {
clientId: '<your-client-id>',
serverOrigin: 'https://localhost:8090',
afterSignInUrl: 'http://localhost:3000/callback',
afterSignOutUrl: 'http://localhost:3000',
scope: ['openid', 'profile'],
sessionCookieExpiryTime: 3600, // 1 hour
}