From 7a191257e37ef1b3eaacd921d3943d51478d49f8 Mon Sep 17 00:00:00 2001 From: ilia Date: Sun, 4 Jan 2026 12:49:20 -0500 Subject: [PATCH] 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. --- lib/auth.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/auth.ts b/lib/auth.ts index 846c383..03f5b8b 100644 --- a/lib/auth.ts +++ b/lib/auth.ts @@ -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