Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth-helpers-nextjs@next sign out sync #244

Closed
tourbillonlabs opened this issue Sep 6, 2022 · 2 comments
Closed

auth-helpers-nextjs@next sign out sync #244

tourbillonlabs opened this issue Sep 6, 2022 · 2 comments
Labels
nextjs Next.js specific functionality question Further information is requested

Comments

@tourbillonlabs
Copy link

tourbillonlabs commented Sep 6, 2022

Bug report

Describe the bug

Am experimenting with @next of auth-helpers due to #171 and announcement of https://supabase.com/blog/supabase-js-v2 which appears to address the signed out issue as @latest doesn't use @supabase/supabase-js@rc.

"@supabase/auth-helpers-nextjs": "^0.4.0-next.0",
"@supabase/auth-helpers-react": "^0.3.0-next.0",
"@supabase/auth-helpers-shared": "^0.2.0-next.0",
"@supabase/supabase-js": "2.0.0-rc.7",

As the /api/auth helpers are no longer in this package, I created a new API logout endpoint that calls supabaseClient.auth.signOut(). However, the signed out state does not appear to reflect client-side. It retains the current session and onAuthStateChange does not fire with the SIGNED_OUT event. Signing out on the client works fine.

If we wanted to keep supabase calls in the API like the latest helper, how would we trigger an update in the client to fetch the current session state?

I understand that @next is in progress and that this issue may be moot once it is released, but I want to raise this just in case.

To Reproduce

With @next versions of helpers and @rc of supabase-js in nextjs:

While authenticated in the client (and using the new SessionContextProvider), call await supabaseClient.auth.signOut(); from an /api endpoint.

onAuthStateChange will not fire SIGNED_OUT event, client will show past session, while subsequent /api calls will have no active session.

Expected behavior

For signed out session state initiated in next.js API to reflect in the client.

System information

  • OS: macOS
  • Browser (if applies) Chrome
  • Version of supabase-js: see above
  • Version of Node.js: 16.14.2
@tourbillonlabs tourbillonlabs added the bug Something isn't working label Sep 6, 2022
@Ashutosh-Malve
Copy link

Having the same problem

@thorwebdev thorwebdev added question Further information is requested nextjs Next.js specific functionality and removed bug Something isn't working labels Sep 28, 2022
@thorwebdev
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nextjs Next.js specific functionality question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants