Session Access Token and JWT Access Token Different #1742
-
Your question What are you trying to do Reproduction Feedback
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
me too, do you have same problem with me ? callbacks: {
async session(session, user) {
// console.log("session user", user.myCustomData, session)
session.user.myCustomData = user.myCustomData
console.log("session", session)
return Promise.resolve(session)
},
async jwt(token, user, account, profile, isNewUser) {
console.log("token", token)
console.log("user", user)
console.log("account", account)
console.log("profile", profile)
if(profile){
token.customdata = profile.myCustomData
}
return token
}
}, |
Beta Was this translation helpful? Give feedback.
-
Please read the docs carefully: https://next-auth.js.org/configuration/callbacks#jwt-callback https://next-auth.js.org/configuration/callbacks#session-callback NOTE ⚠: If you need to fetch data, do it in the if branch of the |
Beta Was this translation helpful? Give feedback.
Please read the docs carefully:
https://next-auth.js.org/configuration/callbacks#jwt-callback
https://next-auth.js.org/configuration/callbacks#session-callback
NOTE ⚠: If you need to fetch data, do it in the if branch of the
jwt
callback, to avoid expensive session responses.