-
-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Improve documentation
Link
Perhaps in this page: https://supabase.com/docs/guides/auth/server-side, or this one: https://supabase.com/docs/guides/auth/third-party/overview
Describe the problem
I was using the @supabase/ssr
package for a PoC I'm building with TanStack Start, so I thought of using the SSR specific package to use Supabase, as described here: https://supabase.com/docs/guides/auth/server-side. Later, I wanted to use an alternative auth (better-auth) while still using Supabase. Thus, I was following the following documentation to change my configuration: https://supabase.com/docs/guides/auth/third-party/overview. I first didn't notice that the examples were using @supabase/supabase-js
package, but I thought that it should still work for this use case. Unfortunately it did not, and it was throwing some misleading error:
@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.onAuthStateChange is not possible
After looking at the createServerClient
implementation, I figured that I shouldn't be using the @supabase/ssr
if I'm using a third-party authentication:
Line 179 in a1b60ba
client.auth.onAuthStateChange(async (event: AuthChangeEvent) => { |
Describe the improvement
I think either of the pages I mentioned above can have a note saying that the @supabase/ssr
package should not be used with third-party authentication, and default to the @supabase/supabase-js
. Unless there's another benefit for using this package except the Supabase first-party auth, in which case the client should be updated to not call supabase.auth.onAuthStateChange
.