From 1f7164ed2b09dd8e2a23abc66ce7c5e6993ea3e4 Mon Sep 17 00:00:00 2001 From: LucasDLTG Date: Wed, 6 May 2026 22:17:29 +0200 Subject: [PATCH] feat: add sub to token --- src/lib/auth.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/auth.ts b/src/lib/auth.ts index d4d685c..886ff79 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -4,9 +4,9 @@ import { JWT } from "next-auth/jwt"; declare module "next-auth" { interface Session { - accessToken?: string; - idToken?: string; - roles?: string[]; + accessToken: string; + idToken: string; + roles: string[]; error?: string; } } @@ -126,6 +126,7 @@ export const authOptions: NextAuthOptions = { token.refreshToken = account.refresh_token!; token.idToken = account.id_token!; token.accessTokenExpiresAt = account.expires_at!; + token.sub = decodedAccessToken.sub! token.refreshTokenExpiresAt = decodedRefreshToken.exp ?? NEVER_EXPIRES; token.roles = [ ...new Set([