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([