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" {
|
declare module "next-auth" {
|
||||||
interface Session {
|
interface Session {
|
||||||
accessToken?: string;
|
accessToken: string;
|
||||||
idToken?: string;
|
idToken: string;
|
||||||
roles?: string[];
|
roles: string[];
|
||||||
error?: string;
|
error?: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,6 +126,7 @@ export const authOptions: NextAuthOptions = {
|
|||||||
token.refreshToken = account.refresh_token!;
|
token.refreshToken = account.refresh_token!;
|
||||||
token.idToken = account.id_token!;
|
token.idToken = account.id_token!;
|
||||||
token.accessTokenExpiresAt = account.expires_at!;
|
token.accessTokenExpiresAt = account.expires_at!;
|
||||||
|
token.sub = decodedAccessToken.sub!
|
||||||
token.refreshTokenExpiresAt = decodedRefreshToken.exp ?? NEVER_EXPIRES;
|
token.refreshTokenExpiresAt = decodedRefreshToken.exp ?? NEVER_EXPIRES;
|
||||||
token.roles = [
|
token.roles = [
|
||||||
...new Set([
|
...new Set([
|
||||||
|
|||||||
Reference in New Issue
Block a user