Skip to content

Commit 8ed42ff

Browse files
authored
fix: use cookie name as storage key (#730)
* fix: use cookie name as storage key * chore: add changeset
1 parent 041f097 commit 8ed42ff

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.changeset/six-moles-perform.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@supabase/ssr': minor
3+
---
4+
5+
use custom cookie name set

packages/ssr/src/createServerClient.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ export function createServerClient<
3838

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

41+
// use the cookie name as the storageKey value if it's set
42+
if (cookieOptions?.name) {
43+
userDefinedClientOptions.auth = {
44+
...userDefinedClientOptions.auth,
45+
storageKey: cookieOptions.name
46+
};
47+
}
48+
4149
const cookieClientOptions = {
4250
global: {
4351
headers: {

0 commit comments

Comments
 (0)