auth-helpers
auth-helpers copied to clipboard
Multiple GoTrueClient instances when using `supabase/ssr` and `@supabase/auth-helpers`
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
- install both "@supabase/ssr" and ""@supabase/auth-helpers-react"
- create a next page with a hook like
useSession
and also create an ssr browser client - load a page and check the console.
Expected behavior
No issues with the library
Screenshots
System information
- Browser (if applies)chrome, firefox
- Version of supabase-js: 2.39.3
What is the point to use both libraries? Official documentation says that you should use only one or another, not both.
@kvetoslavnovak The post clearly says why, supabase/ssr
does not have the useSession
, useUser
hooks
closing, no longer popping up