[PR #7821] [MERGED] Fix (expo): expo client no longer creates malformed cookie #15821

Closed
opened 2026-04-13 10:14:40 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7821
Author: @Laurin-Notemann
Created: 2/6/2026
Status: Merged
Merged: 2/6/2026
Merged by: @Bekacru

Base: canaryHead: canary


📝 Commits (1)

  • cd366df fix(expo): when acc is empty in the getCookie function in the expo client only return the key value pair

📊 Changes

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

View changed files

📝 packages/expo/src/client.ts (+1 -1)

📄 Description

This issue fixes #7674.

According to my research and different testing when acc is empty it creates a cookie which is starting with a ";" which is not accepted by my google cloud load balancer. Right now I am just overwriting my cookie that is being sent like this:

{
	id: 'fix-cookie-header',
	fetchPlugins: [
		{
			id: 'fix-cookie-header',
			name: 'fix-cookie-header',
			init(url, options) {
				const headers = options?.headers as Record<string, string> | undefined;
				if (headers?.cookie?.startsWith('; ')) {
					headers.cookie = headers.cookie.slice(2); // Remove leading "; "
				}
				return { url, options };
			},
		},
	],
},

As this is just a temporary fix I created this PR to fix this causing issue.

I did not encounter this issue with my hetzner vps and a traefik reverse proxy, leaving me to believe that Google enforces the RFC 6265 standard.


Summary by cubic

Fixes the Expo client’s cookie builder to avoid a leading “; ” when constructing the first cookie. This prevents malformed Cookie headers and avoids rejections by RFC 6265–compliant proxies (e.g., Google Cloud Load Balancer).

Written for commit cd366df52b. 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/7821 **Author:** [@Laurin-Notemann](https://github.com/Laurin-Notemann) **Created:** 2/6/2026 **Status:** ✅ Merged **Merged:** 2/6/2026 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `canary` --- ### 📝 Commits (1) - [`cd366df`](https://github.com/better-auth/better-auth/commit/cd366df52b7bfc101e924fbbfc75a3ec55418457) fix(expo): when acc is empty in the getCookie function in the expo client only return the key value pair ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/expo/src/client.ts` (+1 -1) </details> ### 📄 Description This issue fixes #7674. According to my research and different testing when acc is empty it creates a cookie which is starting with a ";" which is not accepted by my google cloud load balancer. Right now I am just overwriting my cookie that is being sent like this: ``` { id: 'fix-cookie-header', fetchPlugins: [ { id: 'fix-cookie-header', name: 'fix-cookie-header', init(url, options) { const headers = options?.headers as Record<string, string> | undefined; if (headers?.cookie?.startsWith('; ')) { headers.cookie = headers.cookie.slice(2); // Remove leading "; " } return { url, options }; }, }, ], }, ``` As this is just a temporary fix I created this PR to fix this causing issue. I did not encounter this issue with my hetzner vps and a traefik reverse proxy, leaving me to believe that Google enforces the RFC 6265 standard. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes the Expo client’s cookie builder to avoid a leading “; ” when constructing the first cookie. This prevents malformed Cookie headers and avoids rejections by RFC 6265–compliant proxies (e.g., Google Cloud Load Balancer). <sup>Written for commit cd366df52b7bfc101e924fbbfc75a3ec55418457. 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-13 10:14:40 -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#15821