[PR #3705] [MERGED] fix(expo): improve cookie expiration handling #21864

Closed
opened 2026-04-15 20:39:46 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3705
Author: @Kinfe123
Created: 7/30/2025
Status: Merged
Merged: 7/31/2025
Merged by: @Bekacru

Base: mainHead: fix/expo-cookie-expiration


📝 Commits (2)

📊 Changes

3 files changed (+16 additions, -11 deletions)

View changed files

.changeset/olive-toys-pump.md (+5 -0)
📝 packages/expo/src/client.ts (+7 -7)
📝 packages/expo/src/expo.test.ts (+4 -4)

📄 Description

closes #3034

Issue in getCookie() function that properly parses date strings into Date objects before making comparisons. I've also fixed the max-age handling in getSetCookie() to correctly convert seconds to milliseconds by multiplying the value by 1000. Furthermore, I've updated the precedence logic when both Expires and Max-Age headers are present to align with the cookie specification, which states that Max-Age should take precedence.


Summary by cubic

Fixed cookie expiration handling in the Expo client to correctly parse date strings, apply max-age precedence, and store expiration as ISO strings.

  • Bug Fixes
    • Parse cookie expiration dates before comparing.
    • Multiply max-age by 1000 to convert seconds to milliseconds.
    • Use max-age over expires when both are present, following spec.

🔄 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/3705 **Author:** [@Kinfe123](https://github.com/Kinfe123) **Created:** 7/30/2025 **Status:** ✅ Merged **Merged:** 7/31/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `fix/expo-cookie-expiration` --- ### 📝 Commits (2) - [`a815e93`](https://github.com/better-auth/better-auth/commit/a815e931a2b09b323e4ca49ac50aafa1fad3fe57) fix: cookie expiration in expo - [`899cc4f`](https://github.com/better-auth/better-auth/commit/899cc4fe52f39439ba7a8552b0307076a8195560) changesets ### 📊 Changes **3 files changed** (+16 additions, -11 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/olive-toys-pump.md` (+5 -0) 📝 `packages/expo/src/client.ts` (+7 -7) 📝 `packages/expo/src/expo.test.ts` (+4 -4) </details> ### 📄 Description closes #3034 Issue in `getCookie()` function that properly parses date strings into Date objects before making comparisons. I've also fixed the `max-age` handling in `getSetCookie()` to correctly convert seconds to milliseconds by multiplying the value by 1000. Furthermore, I've updated the precedence logic when both `Expires` and `Max-Age` headers are present to align with the cookie specification, which states that `Max-Age` should take precedence. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixed cookie expiration handling in the Expo client to correctly parse date strings, apply max-age precedence, and store expiration as ISO strings. - **Bug Fixes** - Parse cookie expiration dates before comparing. - Multiply max-age by 1000 to convert seconds to milliseconds. - Use max-age over expires when both are present, following spec. <!-- 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-15 20:39:46 -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#21864