You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auth helpers for the supported frameworks use CookieAuthStorageAdapter to parse and serialize auth-token and code-verifier cookies. When using @supabase/ssr (when using your own SSR framework), ServerCookieMethods provide methods to get, set and delete cookies , but do not automatically parse the cookies for consumption for the StorageAdapter used by the SupabaseClient.
To Reproduce
Configure PKCE based login method (OAuth) provider in your Supabase app
Use your own SSR framework, with methods/libraries to store cookies. Create a server side login page to initiate login with the auth provider using supabaseClient.auth.signInWithOAuth method. Make sure to use the createServerClient function to create a server side client from the @supabase/ssr package, with your SSR framework's cookie storage methods as a options.cookies parameters with the type ServerCookieMethods to store/parse the cookies.
Use the supabaseClient, and implement callback route in SSR to enable PKCE auth flow, and exchange code for session tokens using the supabaseClient.auth.exchangeCodeForSession method.
Test out the login, and inspect the cookies- the client will fail to find the cookie suffixed with core-verifier even though it will exist in the browser (or there might be parsing errors in the format the cookie was saved as).
Expected behavior
The ServerCookieMethodsset method should receive the final serialized cookies expected by the supabaseClient on deserialization, and vice-versa on the get method.
I'm implementing a solve by using CookieAuthStorageAdapter from @supabase/auth-helpers-shared. However, CookieAuthStorageAdapter needs to use this PR (feat: allow promises in CookieAuthStorageAdapter #609) to allow for an async getServerCookieMethods method.
The text was updated successfully, but these errors were encountered:
Bug report
Describe the bug
Auth helpers for the supported frameworks use CookieAuthStorageAdapter to parse and serialize
auth-token
andcode-verifier
cookies. When using @supabase/ssr (when using your own SSR framework),ServerCookieMethods
provide methods to get, set and delete cookies , but do not automatically parse the cookies for consumption for theStorageAdapter
used by the SupabaseClient.To Reproduce
supabaseClient.auth.signInWithOAuth
method. Make sure to use thecreateServerClient
function to create a server side client from the @supabase/ssr package, with your SSR framework's cookie storage methods as aoptions.cookies
parameters with the typeServerCookieMethods
to store/parse the cookies.supabaseClient.auth.exchangeCodeForSession
method.core-verifier
even though it will exist in the browser (or there might be parsing errors in the format the cookie was saved as).Expected behavior
The
ServerCookieMethods
set
method should receive the final serialized cookies expected by the supabaseClient on deserialization, and vice-versa on theget
method.Screenshots
N/A
System information
"@supabase/ssr": "https://esm.sh/@supabase/[email protected]"
"@supabase/auth-helpers-shared": "https://esm.sh/@supabase/[email protected]"
Additional context
I'm implementing a solve by using
CookieAuthStorageAdapter
from @supabase/auth-helpers-shared. However,CookieAuthStorageAdapter
needs to use this PR (feat: allow promises in CookieAuthStorageAdapter #609) to allow for an asyncget
ServerCookieMethods
method.The text was updated successfully, but these errors were encountered: