Skip to main content

`CookieConfig`

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

CookieConfig is a constants class that exposes the default values used for session cookie configuration in the Choreo Identity & Access Management 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.

Was this page helpful?