feat: add sub to token
This commit is contained in:
+4
-3
@@ -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([
|
||||
|
||||
Reference in New Issue
Block a user