-
I'm using the default the google provider setup provided by next-auth. After logging in, the user object only contains the name, email and image, but not the id. Does anyone know why this could be? Is there a setting or option somewhere that needs to be changed? |
Beta Was this translation helpful? Give feedback.
Answered by
lsbyerley
Apr 22, 2022
Replies: 1 comment
-
For anyone else who comes across this, you can pass the id to the user object in the session callback.. ...
callbacks: {
async session({ session, token, user }) {
// Send properties to the client, like the id
session.user.id = token.sub;
return session;
},
},
... |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lsbyerley
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For anyone else who comes across this, you can pass the id to the user object in the session callback..