From 8d85be453b1802370d75a6cda789c0402f02052b Mon Sep 17 00:00:00 2001 From: Kang Ming Date: Tue, 9 Apr 2024 17:47:33 +0800 Subject: [PATCH] fix: allow setting custom cookie name in createBrowserClient (#746) * fix: allow setting custom cookie name in createBrowserClient * chore: add changeset --- .changeset/proud-coins-help.md | 5 +++++ packages/ssr/src/createBrowserClient.ts | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 .changeset/proud-coins-help.md diff --git a/.changeset/proud-coins-help.md b/.changeset/proud-coins-help.md new file mode 100644 index 00000000..8b82e3e9 --- /dev/null +++ b/.changeset/proud-coins-help.md @@ -0,0 +1,5 @@ +--- +'@supabase/ssr': minor +--- + +fix custom cookie options in browser client diff --git a/packages/ssr/src/createBrowserClient.ts b/packages/ssr/src/createBrowserClient.ts index b15f88f7..bab59d1c 100644 --- a/packages/ssr/src/createBrowserClient.ts +++ b/packages/ssr/src/createBrowserClient.ts @@ -51,6 +51,13 @@ export function createBrowserClient< cookies = cookies || {}; } + if (cookieOptions?.name) { + userDefinedClientOptions.auth = { + ...userDefinedClientOptions.auth, + storageKey: cookieOptions.name + }; + } + const cookieClientOptions = { global: { headers: {