© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•11mo ago•
2 replies
Hamodaben

I can't retrieve a the current user or session on the server side in Nextjs

I implemented the sign in functionality using google provider
I used CreateClient to instantiate a supabase object
I used SignInWithOauth

The authentication works well but and i was even able to print the current session
On the client using getcurrentSession inside a UseEffect


I moved to the next step which is protecting my routes , and as I'm using next js I've tried with next middelwares to check the current user and redirect him based on the data from getuser()

But unfortunately I'm still getting uer :null

Even though i have tried instantiate supabase object using CreateServerClient
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

How to get user or session info on server side?
SupabaseSSupabase / help-and-questions
4y ago
Using Supabase in NextJS Server Side
SupabaseSSupabase / help-and-questions
14mo ago
NextJS: User data client side?
SupabaseSSupabase / help-and-questions
2y ago
How do I use a Supabase session server-side?
SupabaseSSupabase / help-and-questions
4y ago