Skip to main content

CookieConfig

CookieConfig is a constants class that exposes the default values used for session cookie configuration in the ThunderID Node.js SDK. Use these constants when setting cookies for session management or when passing options to getSessionCookieOptions.

Usage

src/routes/callback.ts
import { CookieConfig } from '@thunderid/node'

// Use the default session cookie name
res.cookie(CookieConfig.SESSION_COOKIE_NAME, sessionId, {
httpOnly: CookieConfig.DEFAULT_HTTP_ONLY,
maxAge: CookieConfig.DEFAULT_MAX_AGE * 1000, // convert to milliseconds
sameSite: CookieConfig.DEFAULT_SAME_SITE,
secure: CookieConfig.DEFAULT_SECURE,
})

Constants

ConstantTypeValueDescription
SESSION_COOKIE_NAMEstring__<vendor>__sessionThe name of the session cookie. The vendor prefix is injected automatically.
TEMP_SESSION_COOKIE_NAMEstring__<vendor>__temp.sessionThe name of the temporary session cookie used during the authorization flow.
DEFAULT_MAX_AGEnumber3600Default cookie lifetime in seconds (1 hour).
DEFAULT_HTTP_ONLYbooleantrueWhether the cookie is inaccessible to JavaScript.
DEFAULT_SAME_SITE'lax' | 'strict' | 'none''lax'Default SameSite attribute for cross-origin request behavior.
DEFAULT_SECUREbooleantrueWhether the cookie requires an HTTPS connection.

Explore with AI

ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© Copyright Linux Foundation Europe.For web site terms of use, trademark policy and other project policies please see https://linuxfoundation.eu/en/policies.