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:
|
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.
Additional context
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/ssrpackage 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-jspackage, but I thought that it should still work for this use case. Unfortunately it did not, and it was throwing some misleading error:After looking at the
createServerClientimplementation, I figured that I shouldn't be using the@supabase/ssrif I'm using a third-party authentication:ssr/src/createServerClient.ts
Line 179 in a1b60ba
Describe the improvement
I think either of the pages I mentioned above can have a note saying that the
@supabase/ssrpackage 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 callsupabase.auth.onAuthStateChange.Additional context