[PR #8089] [MERGED] fix(bearer): use semicolon separator when merging cookie headers #7738

Closed
opened 2026-03-13 13:47:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8089
Author: @bytaesu
Created: 2/21/2026
Status: Merged
Merged: 2/21/2026
Merged by: @Bekacru

Base: canaryHead: 2026-02-21/fix/bearer-cookie-separator


📝 Commits (1)

  • 9f05d84 fix(bearer): use semicolon separator when merging cookie headers

📊 Changes

1 file changed (+7 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/plugins/bearer/index.ts (+7 -2)

📄 Description

I tested it:
in Node.js and Bun, values are separated by “; “, while in Deno and Cloudflare Workers they’re separated by “, “. Since our Vitest runs on the Node.js runtime, adding a test case wouldn’t be meaningful, so I just left a comment in the code.


Summary by cubic

Fix cookie header merging in the bearer plugin by using headers.set() and joining with "; " per RFC 6265. This prevents cookie parsing issues in Deno/Cloudflare and ensures consistent behavior across runtimes when adding the sessionToken.

Written for commit 9f05d8429e. 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/8089 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 2/21/2026 **Status:** ✅ Merged **Merged:** 2/21/2026 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `2026-02-21/fix/bearer-cookie-separator` --- ### 📝 Commits (1) - [`9f05d84`](https://github.com/better-auth/better-auth/commit/9f05d8429ed74c9b9fb6236299a8b324c3758ceb) fix(bearer): use semicolon separator when merging cookie headers ### 📊 Changes **1 file changed** (+7 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/bearer/index.ts` (+7 -2) </details> ### 📄 Description I tested it: in Node.js and Bun, values are separated by “; “, while in Deno and Cloudflare Workers they’re separated by “, “. Since our Vitest runs on the Node.js runtime, adding a test case wouldn’t be meaningful, so I just left a comment in the code. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fix cookie header merging in the bearer plugin by using headers.set() and joining with "; " per RFC 6265. This prevents cookie parsing issues in Deno/Cloudflare and ensures consistent behavior across runtimes when adding the sessionToken. <sup>Written for commit 9f05d8429ed74c9b9fb6236299a8b324c3758ceb. 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-03-13 13:47:45 -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#7738