DEV Community

Discussion on: Creating Protected Routes In NextJS With Supabase

Collapse
 
ankitjey profile image
Ankit Jena

Facing the same issue on my end as well, the auth.user always returns null

Collapse
 
meerbahadin profile image
Meer Bahadin

That's because in this tutorial she uses a client-side approach in the server-side! you must save the user details in the cookie or authenticate on the client-side just like the official example available on the supabase website! personally, I fixed with the next-auth library I just used the supabase API to look up for the user or register them then authenticating them using credential provider provided by Next-Auth and it works like charm!

Thread Thread
 
gunturkh profile image
Guntur Kurniawan Heryanto

Hi @meerbahadin ! I'm currently facing the same issue and wondering if you have any code/reference for doing this using your solution with next-auth & supabase? Since i myself still struggling with implementing supabase auth for protecting some page for some time now haha.