[PR #8648] [MERGED] fix: set stateless cookieCache maxAge to match session expiresIn #25018

Closed
opened 2026-04-15 22:41:34 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8648
Author: @himself65
Created: 3/17/2026
Status: Merged
Merged: 3/20/2026
Merged by: @himself65

Base: canaryHead: fix/8638-stateless-maxage


📝 Commits (3)

  • 97bc1a4 fix: set stateless cookieCache maxAge to match session expiresIn (#8638)
  • fb8ddf2 test: update tests to reflect stateless cookieCache maxAge default
  • 6059bc9 fix: format cookieCache maxAge assertion to single line

📊 Changes

2 files changed (+16 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/context/create-context.test.ts (+15 -2)
📝 packages/better-auth/src/context/create-context.ts (+1 -0)

📄 Description

Summary

  • When no database is provided, Better Auth auto-configures stateless mode
  • cookieCache.maxAge was not set in the auto-config, defaulting to 5 minutes
  • Users got logged out after 5 minutes instead of the documented 7 days
  • Now maxAge defaults to match session.expiresIn (7 days by default)

Closes #8638

Test plan

  • Run a project with stateless auth (no database configured)
  • Rely on defaults — session should persist for 7 days, not 5 minutes

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8648 **Author:** [@himself65](https://github.com/himself65) **Created:** 3/17/2026 **Status:** ✅ Merged **Merged:** 3/20/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/8638-stateless-maxage` --- ### 📝 Commits (3) - [`97bc1a4`](https://github.com/better-auth/better-auth/commit/97bc1a493a0419e525a582c07ea42106789c7076) fix: set stateless cookieCache maxAge to match session expiresIn (#8638) - [`fb8ddf2`](https://github.com/better-auth/better-auth/commit/fb8ddf2b0ccd738309c023a9b5e7410786d877c7) test: update tests to reflect stateless cookieCache maxAge default - [`6059bc9`](https://github.com/better-auth/better-auth/commit/6059bc9ab782f209e93f4ba408541c0fc4ea1b9d) fix: format cookieCache maxAge assertion to single line ### 📊 Changes **2 files changed** (+16 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/context/create-context.test.ts` (+15 -2) 📝 `packages/better-auth/src/context/create-context.ts` (+1 -0) </details> ### 📄 Description ## Summary - When no database is provided, Better Auth auto-configures stateless mode - `cookieCache.maxAge` was not set in the auto-config, defaulting to 5 minutes - Users got logged out after 5 minutes instead of the documented 7 days - Now `maxAge` defaults to match `session.expiresIn` (7 days by default) Closes #8638 ## Test plan - Run a project with stateless auth (no database configured) - Rely on defaults — session should persist for 7 days, not 5 minutes --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 22:41:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#25018