Skip to main content

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

PropertyTypeRequiredDefaultDescription
sessionCookieExpiryTimenumber86400 (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:

  1. The sessionCookieExpiryTime property in the configuration object.
  2. The ASGARDEO_SESSION_COOKIE_EXPIRY_TIME environment variable.
  3. The built-in default of 86400 seconds (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:

PropertyTypeRequiredDescription
clientIdstringThe client ID of your application registered in ThunderID.
serverOriginstringThe base URL of the ThunderID instance (for example, https://localhost:8090).
afterSignInUrlstringThe URL to redirect to after a successful sign-in.
afterSignOutUrlstringThe URL to redirect to after sign-out.
clientSecretstringThe client secret. Required for confidential clients only.
scopestring[]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
}
ThunderID LogoThunderID Logo

Product

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