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.

The Express SDK exports CookieConfig and SESSION_COOKIE_NAME for the session cookie behavior used by the SDK.

Import​

const {CookieConfig, SESSION_COOKIE_NAME} = require('@thunderid/express');
ExportValueDescription
SESSION_COOKIE_NAME'THUNDERID_SESSION_ID'Session cookie key used by the Express SDK
PropertyValue
defaultExpirySeconds86400
defaultHttpOnlytrue
defaultSameSite'lax'
defaultSecurefalse

Usage​

You do not need to set these values directly when sessionCookie options are omitted from ExpressClientConfig. The SDK uses these defaults automatically.

index.js
const {SESSION_COOKIE_NAME} = require('@thunderid/express');

app.get('/session-id', (req, res) => {
res.json({sessionId: req.cookies?.[SESSION_COOKIE_NAME] ?? null});
});

Was this page helpful?