Server session don't get updated with user object
Unanswered
Black carpenter ant posted this in #help-forum
Black carpenter antOP
I'm using NextAuth to log in my users, and I want to get the users data from the getServerSession hook, but for some reason, the user object don't get updated on the server session, only the client's useSession object.
It seems like it get updated afterwards in the session callback in NextAuth, so when I get it in the serverSession, it's not updated:
My console logs:
My NextAuth code
It seems like it get updated afterwards in the session callback in NextAuth, so when I get it in the serverSession, it's not updated:
My console logs:
User retrieved from custom backend
server session {
user: {
name: undefined,
email: 'alexander.f.lindgren@gmail.com',
image: undefined
}
}
session after update in callback {
user: {
name: undefined,
email: 'alexander.f.lindgren@gmail.com',
image: undefined,
first_name: 'Alexander',
last_name: 'Lindgren',
username: 'alexander.f.lindgren'
},
expires: '2024-03-15T18:25:22.723Z',
accessToken: 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzA4Mjk1MTE5LCJpYXQiOjE3MDc5MzUxMTksImp0aSI6ImU1Yzk2NDJkNWNjMDRhYWJiZGRkNTY4MWJhN2FkZWQzIiwidXNlcl9pZCI6MTEsImN1c3RvbV9maWVsZCI6IkN1c3RvbSB2YWx1ZSJ9.CCCxxvnhcnH3xSRdSnvigedDyV2YEzmn3-jBIuUqoa8nBAvmeOSoIS5_QvGaBN6GX0wfqIeSK-8h8Jz25gtrlQ'
}My NextAuth code