Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1889
Changes
This PR introduces enhanced configuration options for session cookies, allowing for finer control over their attributes.
SessionCookieOptions
:domain
: Specifies theDomain
attribute for the session cookie.transient
: Iftrue
, themaxAge
attribute is omitted, making the cookie a session cookie (deleted when the browser closes). Defaults tofalse
.AUTH0_COOKIE_DOMAIN
AUTH0_COOKIE_PATH
AUTH0_COOKIE_TRANSIENT
AUTH0_COOKIE_HTTP_ONLY
AUTH0_COOKIE_SECURE
AUTH0_COOKIE_SAME_SITE
setChunkedCookie
: Logic adjusted to handle thetransient
option by omittingmaxAge
.Auth0Client
: Initialization logic now incorporates values from environment variables as defaults if direct configuration is not provided.AbstractSessionStore
: Now passesdomain
andtransient
options during cookie configuration.Testing
src/server/chunked-cookies.test.ts
to verify the correct behavior of the newdomain
andtransient
options for both single and chunked cookies.Usage
You can configure the new cookie options either through environment variables or directly in the SDK initialization.
1. Using Environment Variables:
Set the desired environment variables in your
.env.local
file or your deployment environment:The SDK will automatically pick up these values.
2. Using
Auth0ClientOptions
(App Router Example):Configure the options directly when initializing the client handlers:
Note: Options provided directly in
Auth0ClientOptions
take precedence over environment variables.