'Nextauth token keeps on nesting
I updated with v4 beta with next-auth
. But the token keeps on nesting on refresh, as in token converts to token.token to token.token.token .... on each refresh for some reason
jwt: async (token, user, account, profile, isNewUser) => {
return token;
},
Solution 1:[1]
From version 3 to 4 the default function of jwt changed from
async jwt(token, user, account, profile, isNewUser) {
return token
}
to
async jwt({ token, user, account, profile, isNewUser }) {
return token
}
Suggesting that you should take the token out of the first parameter using deconstruction instead of returning the whole thing.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | J Teeuwissen |