miikee
TTCTheo's Typesafe Cult
•Created by miikee on 6/4/2024 in #questions
If you are using NextAuth, how are you accessing Auth data in Client Components?
Would you be able to elaborate a bit more on the "keep in sync the user that was created in the DB" comment? Doesn't NextAuth manage this aspect for you?
14 replies
TTCTheo's Typesafe Cult
•Created by miikee on 6/4/2024 in #questions
If you are using NextAuth, how are you accessing Auth data in Client Components?
14 replies
TTCTheo's Typesafe Cult
•Created by miikee on 6/4/2024 in #questions
If you are using NextAuth, how are you accessing Auth data in Client Components?
So my layout.tsx (which is server rendered), I can run a "const session = await auth()" and pass it to my ApplicationLayout component (which utilizes 'user client') like so:
<ApplicationLayout session={session}>
{children}
</ApplicationLayout>
This will allow me to display {session?.user.email} and {session?.user.name} within the children of ApplicationLayout?
14 replies