Skip to content

Commit

Permalink
fix: use cookie name as storage key (#730)
Browse files Browse the repository at this point in the history
* fix: use cookie name as storage key

* chore: add changeset
  • Loading branch information
kangmingtay authored Jan 30, 2024
1 parent 041f097 commit 8ed42ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-moles-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@supabase/ssr': minor
---

use custom cookie name set
8 changes: 8 additions & 0 deletions packages/ssr/src/createServerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ export function createServerClient<

const { cookies, cookieOptions, ...userDefinedClientOptions } = options;

// use the cookie name as the storageKey value if it's set
if (cookieOptions?.name) {
userDefinedClientOptions.auth = {
...userDefinedClientOptions.auth,
storageKey: cookieOptions.name
};
}

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

0 comments on commit 8ed42ff

Please sign in to comment.