flâneur — a map of the web's best reading

Next.js, Supabase/ssr & OAuth. Am I Doing This Right? : Supabase

reddit.com · 6 words · saved by 1 readers

I have an app that is built on the app router in Next.js. I have Discord login/signin currently enabled with Supabase Auth. I just "migrated" everything over to "supabase/srr" and I have it all working. I can connect, login and logout, and all seems to be working. However, the part I am trying to get my head around is accessing a signed in user across my app. In the past I have just used React (not Next.js) and have used the useContext hook to grab logged in user details across my app. I need a couple of things explaining if anyone can help me get an understanding of this: With Next.js I can't use useContext like I have with standard React, as I get errors in relation to "use client" and server side components. Having looked through the docs on ssr, am I right in thinking that once the login and session is created, to access the user on any "client" component, I just need to create a browser client each time like this: const supabase = createBrowserClient( process.env.NEXT_PUBLIC_SUPAB

Reddit - Please wait for verification

Explore this link on the map →

related reading