[PR #7995] [MERGED] fix(session): updateAge extends session_token cookie #33273

Closed
opened 2026-04-17 23:55:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7995
Author: @himself65
Created: 2/16/2026
Status: Merged
Merged: 2/28/2026
Merged by: @Bekacru

Base: canaryHead: himself65/2026/02/16/data


📝 Commits (2)

  • 189ad35 fix(session): updateAge extends session_token cookie
  • 8ba1787 test: add e2e test for session_token refresh in stateless mode

📊 Changes

3 files changed (+308 additions, -0 deletions)

View changed files

e2e/smoke/test/session-token-refresh.spec.ts (+223 -0)
📝 packages/better-auth/src/api/routes/session-api.test.ts (+69 -0)
📝 packages/better-auth/src/api/routes/session.ts (+16 -0)

📄 Description

Fixes: https://github.com/better-auth/better-auth/issues/7994


Summary by cubic

Extends the session_token cookie expiry when the cookie cache refreshes via updateAge. Prevents premature sign-outs by aligning cookie maxAge with session.expiresIn.

  • Bug Fixes
    • On refreshCache.updateAge, re-sets the signed session_token cookie with maxAge = session.expiresIn (undefined when dontRememberMe).
    • Adds a test ensuring session_token max-age is extended during the refresh window (JWE strategy).
    • Addresses https://github.com/better-auth/better-auth/issues/7994.

Written for commit 189ad359cd. Summary will update on new commits.


🔄 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/7995 **Author:** [@himself65](https://github.com/himself65) **Created:** 2/16/2026 **Status:** ✅ Merged **Merged:** 2/28/2026 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `himself65/2026/02/16/data` --- ### 📝 Commits (2) - [`189ad35`](https://github.com/better-auth/better-auth/commit/189ad359cd9909d7707107cf78a368133f284af7) fix(session): updateAge extends session_token cookie - [`8ba1787`](https://github.com/better-auth/better-auth/commit/8ba1787cd80e696f64de8158a1a49c7446eb3bb3) test: add e2e test for session_token refresh in stateless mode ### 📊 Changes **3 files changed** (+308 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `e2e/smoke/test/session-token-refresh.spec.ts` (+223 -0) 📝 `packages/better-auth/src/api/routes/session-api.test.ts` (+69 -0) 📝 `packages/better-auth/src/api/routes/session.ts` (+16 -0) </details> ### 📄 Description Fixes: https://github.com/better-auth/better-auth/issues/7994 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Extends the session_token cookie expiry when the cookie cache refreshes via updateAge. Prevents premature sign-outs by aligning cookie maxAge with session.expiresIn. - **Bug Fixes** - On refreshCache.updateAge, re-sets the signed session_token cookie with maxAge = session.expiresIn (undefined when dontRememberMe). - Adds a test ensuring session_token max-age is extended during the refresh window (JWE strategy). - Addresses https://github.com/better-auth/better-auth/issues/7994. <sup>Written for commit 189ad359cd9909d7707107cf78a368133f284af7. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <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-17 23:55:00 -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#33273