© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
2 replies
AlexWala

getUser and Session returning null even when authenticated

Preface: NextJS

Whenever I sign in it is fine but then after a bit of working on the website and refreshing, supabase auth loses the user (getUser returns null) which redirects to login, but then getSession has a session, so it redirects back to my protected pages which results in an infinite loop. Any help?
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

supabaseClient.auth.getUser returns null even if authenticated.
SupabaseSSupabase / help-and-questions
6mo ago
getClaims returning null
SupabaseSSupabase / help-and-questions
4mo ago
supabase auth.getUser always returns null
SupabaseSSupabase / help-and-questions
4y ago
Next.js middleware with @supabase/ssr: auth.getUser() returns null even when auth cookie exists
SupabaseSSupabase / help-and-questions
4mo ago