Skip to main content

CookieOptions

CookieOptions defines the shape of cookie configuration options used in the ThunderID 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)
ThunderID LogoThunderID Logo

Product

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