[PR #6080] [MERGED] feat(expo): support multiple cookie prefixes for better-auth detection #23329

Closed
opened 2026-04-15 21:38:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6080
Author: @himself65
Created: 11/18/2025
Status: Merged
Merged: 11/18/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/11/18/expo


📝 Commits (1)

  • dafc3c1 feat(expo): support multiple cookie prefixes for better-auth detection

📊 Changes

4 files changed (+162 additions, -14 deletions)

View changed files

📝 docs/content/docs/integrations/expo.mdx (+38 -0)
📝 docs/content/docs/plugins/passkey.mdx (+60 -0)
📝 packages/expo/src/client.ts (+22 -14)
📝 packages/expo/test/expo.test.ts (+42 -0)

📄 Description

Summary by cubic

Adds support for multiple cookie prefixes in the Expo client to correctly detect better-auth cookies and prevent infinite refetching when third-party cookies are set. Documentation for Expo and Passkey is updated with examples for custom cookie names.

  • New Features

    • cookiePrefix now accepts a string or an array of strings; detection checks all provided prefixes, including "__Secure-" variants.
    • hasBetterAuthCookies updated to match session and passkey cookies by prefix; default remains "better-auth".
  • Migration

    • If you use a custom webAuthnChallengeCookie (e.g., "my-app-passkey"), include its prefix (e.g., "my-app") in cookiePrefix.
    • For multiple auth systems, pass an array: ["better-auth", "my-app"].
    • To match cookies without a prefix, set cookiePrefix to "" (empty string); passing [] will not match suffixes.

Written for commit dafc3c114e. Summary will update automatically 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/6080 **Author:** [@himself65](https://github.com/himself65) **Created:** 11/18/2025 **Status:** ✅ Merged **Merged:** 11/18/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/11/18/expo` --- ### 📝 Commits (1) - [`dafc3c1`](https://github.com/better-auth/better-auth/commit/dafc3c114edc4ea62c3e6a4ff88893a581f7663e) feat(expo): support multiple cookie prefixes for better-auth detection ### 📊 Changes **4 files changed** (+162 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/integrations/expo.mdx` (+38 -0) 📝 `docs/content/docs/plugins/passkey.mdx` (+60 -0) 📝 `packages/expo/src/client.ts` (+22 -14) 📝 `packages/expo/test/expo.test.ts` (+42 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds support for multiple cookie prefixes in the Expo client to correctly detect better-auth cookies and prevent infinite refetching when third-party cookies are set. Documentation for Expo and Passkey is updated with examples for custom cookie names. - **New Features** - cookiePrefix now accepts a string or an array of strings; detection checks all provided prefixes, including "__Secure-" variants. - hasBetterAuthCookies updated to match session and passkey cookies by prefix; default remains "better-auth". - **Migration** - If you use a custom webAuthnChallengeCookie (e.g., "my-app-passkey"), include its prefix (e.g., "my-app") in cookiePrefix. - For multiple auth systems, pass an array: ["better-auth", "my-app"]. - To match cookies without a prefix, set cookiePrefix to "" (empty string); passing [] will not match suffixes. <sup>Written for commit dafc3c114edc4ea62c3e6a4ff88893a581f7663e. Summary will update automatically 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-15 21:38:11 -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#23329