feat: Enhance JWT callback logging in authentication

- Added additional details to the JWT callback logging, including token ID, email, name, and role for improved debugging and context during authentication.
- Enhanced visibility into token state when no user is present, aiding in troubleshooting authentication issues.
This commit is contained in:
ilia 2026-01-04 12:49:20 -05:00
parent a465e39a4d
commit 7a191257e3

View File

@ -65,7 +65,11 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
} else {
console.log("JWT callback: no user, token exists", {
hasToken: !!token,
tokenKeys: token ? Object.keys(token) : []
tokenKeys: token ? Object.keys(token) : [],
tokenId: token?.id,
tokenEmail: token?.email,
tokenName: token?.name,
tokenRole: token?.role
})
}
return token