Data
Unanswered
! nolikas posted this in #help-forum
Here's my little snippet: (file is marked as "use client"!)
It returns this string in browser console:
How do I access the user's name, email and image in separate variables?
const { data: session } = useSession();
const data = JSON.stringify(session)
console.log(data)It returns this string in browser console:
{"user":{"user":{"name":"Nolikas","email":"nolikas10@gmail.com","image":"https://lh3.googleusercontent.com/a/ACg8ocL1IkrxH3vM3qgQq8bGu-W7MOqz5tGfq0Ufy3aym7KSsw=s96-c"},"expires":"2024-02-22T21:35:10.816Z","username":null},"expires":"2024-02-22T21:35:10.816Z"}How do I access the user's name, email and image in separate variables?
2 Replies
Bump?
English Lop
const { data: session, status } = useSession()
return <p>Signed in as {session.user.email}</p>Taken from the official documentation:
https://next-auth.js.org/getting-started/client