© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•2mo ago•
1 reply
Dexter

Cannot achieve auth user sync between Supabase and my project

auth🟢SSRCLIstorage🤷other
Hello, today I run into a problem that proved to me I might not be runnin auth as robustly or correctly as I should. I was running my Nextjs project, did some edits and reset my supabase db using
supabase db reset --linked
supabase db reset --linked
to update migrations etc. When I rerun my app locally, the user was still logged in even though no relevant user was anywhere in the supabase db. I assume that is because session or user is cached somewhere. I could still access protected routes that had
const { data } = await supabase.auth.getClaims()
const { data } = await supabase.auth.getClaims()
and a check if that exists but Id get an error when trying to access more information. Printing the getClaims() data showed my old user before the DB reset.

My question would be how can I handle sign outs and user deletions in a more secure or robust way ? Refreshing the page and/or the app still had the user logged in even after the DB nuke.

EDIT: Interestingly, looking into session and local storage they are both empty. In that case how can the user be still signed in and accessing protected routes and I can see his auth details even when Ive reset the entire supabase DB and its empty ? How does getClaims() go through and how do I fix this ?

EDIT 2: I realized a big part of my app is server side which uses cookies for auth/session storage and the session was still being saved there, deleting these tokens worked. Now the questions becomes, how do i clean relevant cookies when signing out or at periodic intervals and refresh all components ?

What are good/common practices regarding this issue ?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Cannot Sync user_id from remote to supabase
SupabaseSSupabase / help-and-questions
2mo ago
get user function supabase.auth.user()
SupabaseSSupabase / help-and-questions
4y ago
reverse sync Supabase back to Supabase cli project
SupabaseSSupabase / help-and-questions
2w ago
Connecting Stripe Sync Engine with Supabase Auth
SupabaseSSupabase / help-and-questions
2mo ago