Skip to content

createSessionCookie()

createSessionCookie(idToken, sessionCookieOptions): Promise<string>

Defined in: CloudFireAuth.ts:441

Creates a new Firebase session cookie with the specified options. The created JWT string can be set as a server-side session cookie with a custom cookie policy, and be used for session management. The session cookie JWT will have the same payload claims as the provided ID token.

See Manage Session Cookies for code samples and detailed documentation.

Parameters

idToken

string

The Firebase ID token to exchange for a session cookie.

sessionCookieOptions

SessionCookieOptions

The session cookie options which includes custom session duration.

Returns

Promise<string>

A promise that resolves on success with the created session cookie.