supabase / auth-helpers

A collection of framework specific Auth utilities for working with Supabase.
https://supabase.github.io/auth-helpers/
MIT License
902 stars 237 forks source link

Multiple GoTrueClient instances when using `supabase/ssr` and `@supabase/auth-helpers` #739

Closed bombillazo closed 1 month ago

bombillazo commented 7 months ago

Bug report

Describe the bug

As recommended by the Supabase docs, we started using the new SSR library to handle our Next.js auth clients int he front end. However, we still need access to the regular auth hooks provided by auth-helpers, such as the useSession hook. So we now have both libraries installed at the same time.

This causes unexpected issues where the auth tokens suddenly get erased and other weird behavior.

To Reproduce

  1. install both "@supabase/ssr" and ""@supabase/auth-helpers-react"
  2. create a next page with a hook like useSession and also create an ssr browser client
  3. load a page and check the console.

Expected behavior

No issues with the library

Screenshots

image

System information

kvetoslavnovak commented 7 months ago

What is the point to use both libraries? Official documentation says that you should use only one or another, not both.

bombillazo commented 7 months ago

@kvetoslavnovak The post clearly says why, supabase/ssr does not have the useSession, useUser hooks

bombillazo commented 1 month ago

closing, no longer popping up