Skip to main content

`CookieOptions`

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

CookieOptions defines the shape of cookie configuration options used in the Choreo Identity & Access Management Node.js SDK. Pass a CookieOptions object to getSessionCookieOptions to override the default cookie settings.

Interface​

interface CookieOptions {
httpOnly?: boolean
maxAge?: number
sameSite?: boolean | 'lax' | 'strict' | 'none'
secure?: boolean
}

Properties​

PropertyTypeDefaultDescription
httpOnlybooleantrueWhen true, the browser blocks JavaScript access to the cookie. Recommended to prevent cross-site scripting (XSS) attacks.
maxAgenumber3600The lifetime of the cookie in seconds.
sameSiteboolean | 'lax' | 'strict' | 'none''lax'Controls how the cookie behaves in cross-origin requests. Use 'strict' for maximum security or 'none' (with secure: true) for cross-origin use cases.
securebooleantrueWhen true, the browser only sends the cookie over HTTPS connections.

Example​

import { CookieOptions, getSessionCookieOptions } from '@thunderid/node'

const options: CookieOptions = {
httpOnly: true,
maxAge: 7200, // 2 hours
sameSite: 'strict',
secure: true,
}

const cookieOptions = getSessionCookieOptions(options)

Was this page helpful?