Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set max-age default cookie option to 400 days #54

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/__snapshots__/createServerClient.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exports[`createServerClient > use cases > should refresh session correctly as ty
"name": "custom-storage-key.0",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -44,7 +44,7 @@ exports[`createServerClient > use cases > should refresh session correctly as ty
"name": "custom-storage-key.1",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand Down Expand Up @@ -75,7 +75,7 @@ exports[`createServerClient > use cases > should refresh session correctly as ty
"name": "sb-project-ref-auth-token.0",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -85,7 +85,7 @@ exports[`createServerClient > use cases > should refresh session correctly as ty
"name": "sb-project-ref-auth-token.1",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -100,7 +100,7 @@ exports[`createServerClient > use cases > should set PKCE code verifier correctl
"name": "custom-storage-key-code-verifier",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -115,7 +115,7 @@ exports[`createServerClient > use cases > should set PKCE code verifier correctl
"name": "sb-project-ref-auth-token-code-verifier",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -140,7 +140,7 @@ exports[`createServerClient > use cases > should set exchange PKCE code for sess
"name": "custom-storage-key.0",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -150,7 +150,7 @@ exports[`createServerClient > use cases > should set exchange PKCE code for sess
"name": "custom-storage-key.1",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand Down Expand Up @@ -195,7 +195,7 @@ exports[`createServerClient > use cases > should set exchange PKCE code for sess
"name": "sb-project-ref-auth-token.0",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -205,7 +205,7 @@ exports[`createServerClient > use cases > should set exchange PKCE code for sess
"name": "sb-project-ref-auth-token.1",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand Down
4 changes: 3 additions & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ export const DEFAULT_COOKIE_OPTIONS: CookieOptions = {
path: "/",
sameSite: "lax",
httpOnly: false,
maxAge: 60 * 60 * 24 * 365 * 1000,
// https://developer.chrome.com/blog/cookie-max-age-expires
// https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-cookie-lifetime-limits
maxAge: 400 * 24 * 60 * 60,
};