File tree Expand file tree Collapse file tree 1 file changed +16
-24
lines changed
packages/console/src/assets/docs/guides/web-next-auth Expand file tree Collapse file tree 1 file changed +16
-24
lines changed Original file line number Diff line number Diff line change @@ -36,32 +36,24 @@ The following is an example of App Router:
3636<Tabs >
3737
3838<TabItem value = " v5" label = " Next Auth v5" >
39- <Code className = " language-ts" >
40- { ` import NextAuth from 'next-auth';
39+
40+ Set the environment variables:
41+
42+ <Code className = " language-env" >
43+ { ` AUTH_LOGTO_ISSUER='${props .endpoint }oidc',
44+ AUTH_LOGTO_ID='${props .app .id }',
45+ AUTH_LOGTO_SECRET='${props .secrets [0 ]?.value ?? props .app .secret }'
46+ ` }
47+ </Code >
48+
49+ Configure the provider:
50+
51+ <Code className = " language-ts" >
52+ { ` import NextAuth from 'next-auth';
53+ import Logto from 'next-auth/providers/logto';
4154
4255export const { handlers, signIn, signOut, auth } = NextAuth({
43- providers: [
44- {
45- id: 'logto',
46- name: 'Logto',
47- type: 'oidc',
48- issuer: '${props .endpoint }oidc',
49- clientId: '${props .app .id }',
50- clientSecret: '${props .secrets [0 ]?.value ?? props .app .secret }',
51- authorization: {
52- params: { scope: 'openid offline_access profile email' },
53- },
54- profile(profile) {
55- // You can customize the user profile mapping here
56- return {
57- id: profile.sub,
58- name: profile.name ?? profile.username,
59- email: profile.email,
60- image: profile.picture,
61- };
62- },
63- },
64- ],
56+ providers: [Logto],
6557}); ` }
6658</Code >
6759</TabItem >
You can’t perform that action at this time.
0 commit comments