diff --git a/examples/nextjs-app/auth.ts b/examples/nextjs-app/auth.ts index 3536ab9..b1533fd 100644 --- a/examples/nextjs-app/auth.ts +++ b/examples/nextjs-app/auth.ts @@ -8,13 +8,26 @@ export const { handlers, signIn, signOut, auth } = NextAuth({ type: 'oidc', clientId: process.env.AUTH_CLIENT_ID, clientSecret: process.env.AUTH_CLIENT_SECRET, - checks: ['pkce', 'state'], + checks: ['pkce', 'state', 'nonce'], authorization: { params: { scope: 'openid profile email' } }, + idToken: true, }], session: { strategy: 'jwt' }, callbacks: { + jwt: ({ token, profile }) => { + if (profile?.sub && profile?.email) { + return { + sub: profile.sub, + name: profile.name, + email: profile.email, + picture: profile.picture, + } + } + + return token + }, session: async ({ session }) => { return session },