auth-helpers icon indicating copy to clipboard operation
auth-helpers copied to clipboard

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

Open bombillazo opened this issue 6 months ago • 2 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

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

  • Browser (if applies)chrome, firefox
  • Version of supabase-js: 2.39.3

bombillazo avatar Feb 06 '24 21:02 bombillazo

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

kvetoslavnovak avatar Feb 08 '24 23:02 kvetoslavnovak

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

bombillazo avatar Feb 09 '24 02:02 bombillazo

closing, no longer popping up

bombillazo avatar Aug 12 '24 20:08 bombillazo