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
Was this page helpful?