© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
2 replies
Rozko

What is the use case for choosing auth.getSession() over auth.getUser() and vice versa?

I understand that auth.getSession() retrieves the session, and getUser() retrieves the current user if exists. But since session returns the data containing the session and user, I am not clear as to what the use case is for both, since from my understanding they can pretty much do the same thing, except that getSession can actually refresh the tokens when needed.
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

getSession(), safeGetSession(), and getUser()
SupabaseSSupabase / help-and-questions
8mo ago
Does auth.getUser() internally invoke the getSession() method?
SupabaseSSupabase / help-and-questions
4y ago
Use case
SupabaseSSupabase / help-and-questions
3y ago
Nextjs Auth Helpers getUser returns type any for user and error
SupabaseSSupabase / help-and-questions
4y ago