Skip to content

Commit

Permalink
fix: allow setting custom cookie name in createBrowserClient (#746)
Browse files Browse the repository at this point in the history
* fix: allow setting custom cookie name in createBrowserClient

* chore: add changeset
  • Loading branch information
kangmingtay authored Apr 9, 2024
1 parent 85ad58b commit 8d85be4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/proud-coins-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@supabase/ssr': minor
---

fix custom cookie options in browser client
7 changes: 7 additions & 0 deletions packages/ssr/src/createBrowserClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ export function createBrowserClient<
cookies = cookies || {};
}

if (cookieOptions?.name) {
userDefinedClientOptions.auth = {
...userDefinedClientOptions.auth,
storageKey: cookieOptions.name
};
}

const cookieClientOptions = {
global: {
headers: {
Expand Down

0 comments on commit 8d85be4

Please sign in to comment.