Skip to content

Commit

Permalink
Revert cookie name to storage key change (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
silentworks authored Nov 4, 2023
1 parent 7663860 commit f7e5c2d
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 41 deletions.
9 changes: 9 additions & 0 deletions .changeset/breezy-lions-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@supabase/auth-helpers-nextjs': patch
'@supabase/auth-helpers-remix': patch
'@supabase/auth-helpers-shared': patch
'@supabase/ssr': patch
'@supabase/auth-helpers-sveltekit': patch
---

Revert cookie name to storage key change
4 changes: 0 additions & 4 deletions packages/nextjs/src/clientComponentClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ export function createClientComponentClient<
);
}

const storageKey = cookieOptions?.name;
delete cookieOptions?.name;

const createNewClient = () =>
createSupabaseClient<Database, SchemaName, Schema>(supabaseUrl, supabaseKey, {
...options,
Expand All @@ -52,7 +49,6 @@ export function createClientComponentClient<
}
},
auth: {
storageKey,
storage: new BrowserCookieAuthStorageAdapter(cookieOptions)
}
});
Expand Down
4 changes: 0 additions & 4 deletions packages/nextjs/src/middlewareClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ export function createMiddlewareClient<
);
}

const storageKey = cookieOptions?.name;
delete cookieOptions?.name;

return createSupabaseClient<Database, SchemaName, Schema>(supabaseUrl, supabaseKey, {
...options,
global: {
Expand All @@ -101,7 +98,6 @@ export function createMiddlewareClient<
}
},
auth: {
storageKey,
storage: new NextMiddlewareAuthStorageAdapter(context, cookieOptions)
}
});
Expand Down
4 changes: 0 additions & 4 deletions packages/nextjs/src/pagesServerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ export function createPagesServerClient<
);
}

const storageKey = cookieOptions?.name;
delete cookieOptions?.name;

return createSupabaseClient<Database, SchemaName, Schema>(supabaseUrl, supabaseKey, {
...options,
global: {
Expand All @@ -100,7 +97,6 @@ export function createPagesServerClient<
}
},
auth: {
storageKey,
storage: new NextServerAuthStorageAdapter(context, cookieOptions)
}
});
Expand Down
4 changes: 0 additions & 4 deletions packages/nextjs/src/routeHandlerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ export function createRouteHandlerClient<
);
}

const storageKey = cookieOptions?.name;
delete cookieOptions?.name;

return createSupabaseClient<Database, SchemaName, Schema>(supabaseUrl, supabaseKey, {
...options,
global: {
Expand All @@ -80,7 +77,6 @@ export function createRouteHandlerClient<
}
},
auth: {
storageKey,
storage: new NextRouteHandlerAuthStorageAdapter(context, cookieOptions)
}
});
Expand Down
4 changes: 0 additions & 4 deletions packages/nextjs/src/serverComponentClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ export function createServerComponentClient<
);
}

const storageKey = cookieOptions?.name;
delete cookieOptions?.name;

return createSupabaseClient<Database, SchemaName, Schema>(supabaseUrl, supabaseKey, {
...options,
global: {
Expand All @@ -77,7 +74,6 @@ export function createServerComponentClient<
}
},
auth: {
storageKey,
storage: new NextServerComponentAuthStorageAdapter(context, cookieOptions)
}
});
Expand Down
4 changes: 0 additions & 4 deletions packages/remix/src/createSupabaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,6 @@ export function createServerClient<
);
}

const storageKey = cookieOptions?.name;
delete cookieOptions?.name;

return createSupabaseClient<Database, SchemaName, Schema>(supabaseUrl, supabaseKey, {
...options,
global: {
Expand All @@ -210,7 +207,6 @@ export function createServerClient<
}
},
auth: {
storageKey,
storage: new RemixServerAuthStorageAdapter(request, response, cookieOptions)
}
});
Expand Down
4 changes: 0 additions & 4 deletions packages/ssr/src/createBrowserClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,10 @@ export function createBrowserClient<
let cookies: CookieMethods = {};
let isSingleton = true;
let cookieOptions: CookieOptionsWithName | undefined;
let storageKey: string | undefined = undefined;
let userDefinedClientOptions;

if (options) {
({ cookies, isSingleton = true, cookieOptions, ...userDefinedClientOptions } = options);
storageKey = cookieOptions?.name;
delete cookieOptions?.name;
}

const cookieClientOptions = {
Expand All @@ -64,7 +61,6 @@ export function createBrowserClient<
autoRefreshToken: isBrowser(),
detectSessionInUrl: isBrowser(),
persistSession: true,
storageKey,
storage: {
getItem: async (key: string) => {
const chunkedCookie = await combineChunks(key, async (chunkName) => {
Expand Down
4 changes: 0 additions & 4 deletions packages/ssr/src/createServerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ export function createServerClient<

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

const storageKey = cookieOptions?.name;
delete cookieOptions?.name;

const cookieClientOptions = {
global: {
headers: {
Expand All @@ -52,7 +49,6 @@ export function createServerClient<
autoRefreshToken: isBrowser(),
detectSessionInUrl: isBrowser(),
persistSession: true,
storageKey,
storage: {
getItem: async (key: string) => {
const chunkedCookie = await combineChunks(key, async (chunkName: string) => {
Expand Down
5 changes: 0 additions & 5 deletions packages/sveltekit/src/supabaseLoadClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ export function createSupabaseLoadClient<
if (browser && cachedBrowserClient) {
return cachedBrowserClient as SupabaseClient<Database, SchemaName, Schema>;
}

const storageKey = cookieOptions?.name;
delete cookieOptions?.name;

const client = createSupabaseClient<Database, SchemaName, Schema>(supabaseUrl, supabaseKey, {
...options,
global: {
Expand All @@ -97,7 +93,6 @@ export function createSupabaseLoadClient<
}
},
auth: {
storageKey,
storage: new SvelteKitLoadAuthStorageAdapter(serverSession, cookieOptions)
}
});
Expand Down
4 changes: 0 additions & 4 deletions packages/sveltekit/src/supabaseServerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ export function createSupabaseServerClient<
cookieOptions?: CookieOptionsWithName;
expiryMargin?: number;
}): SupabaseClient<Database, SchemaName, Schema> {
const storageKey = cookieOptions?.name;
delete cookieOptions?.name;

const client = createSupabaseClient<Database, SchemaName, Schema>(supabaseUrl, supabaseKey, {
...options,
global: {
Expand All @@ -95,7 +92,6 @@ export function createSupabaseServerClient<
}
},
auth: {
storageKey,
storage: new SvelteKitServerAuthStorageAdapter(event, cookieOptions, expiryMargin)
}
});
Expand Down

0 comments on commit f7e5c2d

Please sign in to comment.