Skip to content

@adrianhall/cloudflare-toolkit


@adrianhall/cloudflare-toolkit / lib/testing / buildCookieHeader

Function: buildCookieHeader()

buildCookieHeader(token, isSecure): string

Defined in: src/lib/auth-internal/jwt.ts:302

Build a Set-Cookie header value for the authorisation cookie.

Mirrors the attributes used by Cloudflare Access: HttpOnly; Secure; SameSite=Lax; Path=/

For local dev over plain HTTP the Secure flag is omitted when the request was made to localhost or 127.0.0.1.

Parameters

token

string

isSecure

boolean

Returns

string