@lobehub/lobehub 2.0.0-next.124 → 2.0.0-next.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/rules/db-migrations.mdc +16 -1
- package/.cursor/rules/project-introduce.mdc +1 -1
- package/.cursor/rules/project-structure.mdc +20 -2
- package/.env.example +148 -65
- package/.env.example.development +6 -8
- package/AGENTS.md +1 -3
- package/CHANGELOG.md +25 -0
- package/Dockerfile +6 -6
- package/GEMINI.md +63 -0
- package/changelog/v1.json +9 -0
- package/docs/development/database-schema.dbml +37 -0
- package/docs/self-hosting/advanced/auth.mdx +75 -2
- package/docs/self-hosting/advanced/auth.zh-CN.mdx +75 -2
- package/docs/self-hosting/environment-variables/auth.mdx +187 -1
- package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +187 -1
- package/locales/en-US/auth.json +93 -0
- package/locales/zh-CN/auth.json +107 -1
- package/package.json +5 -2
- package/packages/const/src/auth.ts +2 -1
- package/packages/database/migrations/0049_better_auth.sql +49 -0
- package/packages/database/migrations/meta/0048_snapshot.json +312 -932
- package/packages/database/migrations/meta/0049_snapshot.json +8151 -0
- package/packages/database/migrations/meta/_journal.json +8 -1
- package/packages/database/src/core/migrations.json +13 -0
- package/packages/database/src/index.ts +1 -0
- package/packages/database/src/models/__tests__/session.test.ts +1 -2
- package/packages/database/src/models/user.ts +9 -8
- package/packages/database/src/repositories/tableViewer/index.test.ts +2 -2
- package/packages/database/src/schemas/betterAuth.ts +63 -0
- package/packages/database/src/schemas/index.ts +1 -0
- package/packages/database/src/schemas/ragEvals.ts +1 -2
- package/packages/database/src/schemas/user.ts +3 -2
- package/packages/database/src/server/models/__tests__/user.test.ts +1 -4
- package/packages/types/src/user/preference.ts +11 -0
- package/packages/utils/src/server/__tests__/auth.test.ts +52 -0
- package/packages/utils/src/server/auth.ts +18 -1
- package/src/app/(backend)/api/auth/[...all]/route.ts +19 -0
- package/src/app/(backend)/api/auth/check-user/route.ts +62 -0
- package/src/app/(backend)/middleware/auth/index.ts +14 -0
- package/src/app/(backend)/middleware/auth/utils.test.ts +16 -0
- package/src/app/(backend)/middleware/auth/utils.ts +13 -10
- package/src/app/(backend)/webapi/chat/[provider]/route.test.ts +1 -0
- package/src/app/[variants]/(auth)/reset-password/layout.tsx +12 -0
- package/src/app/[variants]/(auth)/reset-password/page.tsx +209 -0
- package/src/app/[variants]/(auth)/signin/layout.tsx +12 -0
- package/src/app/[variants]/(auth)/signin/page.tsx +448 -0
- package/src/app/[variants]/(auth)/signup/[[...signup]]/BetterAuthSignUpForm.tsx +192 -0
- package/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx +31 -6
- package/src/app/[variants]/(auth)/verify-email/layout.tsx +12 -0
- package/src/app/[variants]/(auth)/verify-email/page.tsx +164 -0
- package/src/app/[variants]/(main)/(mobile)/me/(home)/__tests__/UserBanner.test.tsx +12 -10
- package/src/app/[variants]/(main)/(mobile)/me/(home)/__tests__/useCategory.test.tsx +13 -11
- package/src/app/[variants]/(main)/profile/(home)/Client.tsx +306 -52
- package/src/app/[variants]/(main)/profile/(home)/features/SSOProvidersList/index.tsx +89 -47
- package/src/auth.ts +118 -0
- package/src/components/NextAuth/AuthIcons.tsx +3 -1
- package/src/envs/auth.ts +260 -13
- package/src/envs/email.ts +37 -0
- package/src/features/User/UserPanel/PanelContent.tsx +6 -5
- package/src/features/User/__tests__/PanelContent.test.tsx +15 -6
- package/src/features/User/__tests__/UserAvatar.test.tsx +17 -6
- package/src/features/User/__tests__/useMenu.test.tsx +14 -12
- package/src/layout/AuthProvider/BetterAuth/UserUpdater.tsx +51 -0
- package/src/layout/AuthProvider/BetterAuth/index.tsx +14 -0
- package/src/layout/AuthProvider/index.tsx +3 -0
- package/src/libs/better-auth/auth-client.ts +34 -0
- package/src/libs/better-auth/constants.ts +13 -0
- package/src/libs/better-auth/email-templates/index.ts +3 -0
- package/src/libs/better-auth/email-templates/magic-link.ts +98 -0
- package/src/libs/better-auth/email-templates/reset-password.ts +91 -0
- package/src/libs/better-auth/email-templates/verification.ts +108 -0
- package/src/libs/better-auth/sso/helpers.ts +61 -0
- package/src/libs/better-auth/sso/index.ts +113 -0
- package/src/libs/better-auth/sso/providers/auth0.ts +33 -0
- package/src/libs/better-auth/sso/providers/authelia.ts +35 -0
- package/src/libs/better-auth/sso/providers/authentik.ts +35 -0
- package/src/libs/better-auth/sso/providers/casdoor.ts +48 -0
- package/src/libs/better-auth/sso/providers/cloudflare-zero-trust.ts +41 -0
- package/src/libs/better-auth/sso/providers/cognito.ts +45 -0
- package/src/libs/better-auth/sso/providers/feishu.ts +181 -0
- package/src/libs/better-auth/sso/providers/generic-oidc.ts +44 -0
- package/src/libs/better-auth/sso/providers/github.ts +30 -0
- package/src/libs/better-auth/sso/providers/google.ts +30 -0
- package/src/libs/better-auth/sso/providers/keycloak.ts +35 -0
- package/src/libs/better-auth/sso/providers/logto.ts +38 -0
- package/src/libs/better-auth/sso/providers/microsoft.ts +65 -0
- package/src/libs/better-auth/sso/providers/okta.ts +37 -0
- package/src/libs/better-auth/sso/providers/wechat.ts +140 -0
- package/src/libs/better-auth/sso/providers/zitadel.ts +54 -0
- package/src/libs/better-auth/sso/types.ts +25 -0
- package/src/libs/better-auth/utils/client.ts +1 -0
- package/src/libs/better-auth/utils/common.ts +20 -0
- package/src/libs/better-auth/utils/server.test.ts +61 -0
- package/src/libs/better-auth/utils/server.ts +18 -0
- package/src/libs/trpc/lambda/context.test.ts +116 -0
- package/src/libs/trpc/lambda/context.ts +27 -0
- package/src/libs/trpc/middleware/userAuth.ts +4 -2
- package/src/locales/default/auth.ts +114 -1
- package/src/proxy.ts +71 -7
- package/src/server/globalConfig/index.ts +12 -1
- package/src/server/routers/lambda/user.ts +4 -0
- package/src/server/services/email/README.md +241 -0
- package/src/server/services/email/impls/index.test.ts +39 -0
- package/src/server/services/email/impls/index.ts +32 -0
- package/src/server/services/email/impls/nodemailer/index.ts +108 -0
- package/src/server/services/email/impls/nodemailer/type.ts +31 -0
- package/src/server/services/email/impls/type.ts +61 -0
- package/src/server/services/email/index.test.ts +144 -0
- package/src/server/services/email/index.ts +40 -0
- package/src/services/user/index.test.ts +162 -2
- package/src/services/user/index.ts +6 -3
- package/src/store/user/slices/auth/action.test.ts +213 -16
- package/src/store/user/slices/auth/action.ts +86 -1
- package/src/store/user/slices/auth/initialState.ts +13 -2
- package/src/store/user/slices/auth/selectors.ts +6 -2
- package/src/store/user/slices/common/action.ts +5 -1
- package/src/app/(backend)/api/auth/[...nextauth]/route.ts +0 -3
|
@@ -137,6 +137,42 @@ table async_tasks {
|
|
|
137
137
|
updated_at "timestamp with time zone" [not null, default: `now()`]
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
table accounts {
|
|
141
|
+
access_token text
|
|
142
|
+
access_token_expires_at timestamp
|
|
143
|
+
account_id text [not null]
|
|
144
|
+
created_at timestamp [not null, default: `now()`]
|
|
145
|
+
id text [pk, not null]
|
|
146
|
+
id_token text
|
|
147
|
+
password text
|
|
148
|
+
provider_id text [not null]
|
|
149
|
+
refresh_token text
|
|
150
|
+
refresh_token_expires_at timestamp
|
|
151
|
+
scope text
|
|
152
|
+
updated_at timestamp [not null]
|
|
153
|
+
user_id text [not null]
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
table auth_sessions {
|
|
157
|
+
created_at timestamp [not null, default: `now()`]
|
|
158
|
+
expires_at timestamp [not null]
|
|
159
|
+
id text [pk, not null]
|
|
160
|
+
ip_address text
|
|
161
|
+
token text [not null, unique]
|
|
162
|
+
updated_at timestamp [not null]
|
|
163
|
+
user_agent text
|
|
164
|
+
user_id text [not null]
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
table verifications {
|
|
168
|
+
created_at timestamp [not null, default: `now()`]
|
|
169
|
+
expires_at timestamp [not null]
|
|
170
|
+
id text [pk, not null]
|
|
171
|
+
identifier text [not null]
|
|
172
|
+
updated_at timestamp [not null, default: `now()`]
|
|
173
|
+
value text [not null]
|
|
174
|
+
}
|
|
175
|
+
|
|
140
176
|
table chat_groups {
|
|
141
177
|
id text [pk, not null]
|
|
142
178
|
title text
|
|
@@ -981,6 +1017,7 @@ table users {
|
|
|
981
1017
|
full_name text
|
|
982
1018
|
is_onboarded boolean [default: false]
|
|
983
1019
|
clerk_created_at "timestamp with time zone"
|
|
1020
|
+
email_verified boolean [not null, default: false]
|
|
984
1021
|
email_verified_at "timestamp with time zone"
|
|
985
1022
|
preference jsonb
|
|
986
1023
|
accessed_at "timestamp with time zone" [not null, default: `now()`]
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: LobeChat Authentication Service Configuration
|
|
3
3
|
description: >-
|
|
4
|
-
Learn how to configure external authentication services using Clerk or Next Auth for centralized user authorization management. Supported authentication services include Auth0, Azure ID, etc.
|
|
4
|
+
Learn how to configure external authentication services using Better Auth, Clerk, or Next Auth for centralized user authorization management. Supported authentication services include Auth0, Azure ID, etc.
|
|
5
5
|
|
|
6
6
|
tags:
|
|
7
7
|
- Authentication Service
|
|
8
|
+
- Better Auth
|
|
8
9
|
- Next Auth
|
|
9
10
|
- SSO
|
|
10
11
|
- Clerk
|
|
@@ -12,7 +13,7 @@ tags:
|
|
|
12
13
|
|
|
13
14
|
# Authentication Service
|
|
14
15
|
|
|
15
|
-
LobeChat supports the configuration of external authentication services using Clerk or Next Auth for internal use within enterprises/organizations to centrally manage user authorization.
|
|
16
|
+
LobeChat supports the configuration of external authentication services using Better Auth, Clerk, or Next Auth for internal use within enterprises/organizations to centrally manage user authorization.
|
|
16
17
|
|
|
17
18
|
## Clerk
|
|
18
19
|
|
|
@@ -22,6 +23,78 @@ LobeChat has deeply integrated with Clerk to provide users with a more secure an
|
|
|
22
23
|
|
|
23
24
|
By setting the environment variables `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CLERK_SECRET_KEY` in LobeChat's environment, you can enable and use Clerk.
|
|
24
25
|
|
|
26
|
+
## Better Auth
|
|
27
|
+
|
|
28
|
+
[Better Auth](https://www.better-auth.com) is a modern, framework-agnostic authentication library designed to provide comprehensive, secure, and flexible authentication solutions. It supports various authentication methods including email/password, magic links, and multiple OAuth/SSO providers.
|
|
29
|
+
|
|
30
|
+
### Key Features
|
|
31
|
+
|
|
32
|
+
- **Email/Password Authentication**: Built-in support for traditional email and password login with secure password hashing
|
|
33
|
+
- **Email Verification**: Optional email verification flow with customizable email templates
|
|
34
|
+
- **Magic Link Login**: Passwordless authentication via email magic links
|
|
35
|
+
- **OAuth/SSO Support**: Integration with popular identity providers including Google, GitHub, Microsoft, AWS Cognito, and more
|
|
36
|
+
- **Generic OIDC/OAuth**: Support for any OpenID Connect or OAuth 2.0 compliant provider
|
|
37
|
+
|
|
38
|
+
### Getting Started
|
|
39
|
+
|
|
40
|
+
To enable Better Auth in LobeChat, set the following environment variables:
|
|
41
|
+
|
|
42
|
+
| Environment Variable | Type | Description |
|
|
43
|
+
| -------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
44
|
+
| `NEXT_PUBLIC_ENABLE_BETTER_AUTH` | Required | Set to `1` to enable Better Auth service |
|
|
45
|
+
| `AUTH_SECRET` | Required | Key used to encrypt session tokens. Generate using: `openssl rand -base64 32` |
|
|
46
|
+
| `NEXT_PUBLIC_AUTH_URL` | Optional | The URL accessible from the browser for Better Auth callbacks. Only set this if the default generated URL is incorrect |
|
|
47
|
+
| `AUTH_SSO_PROVIDERS` | Optional | Comma-separated list of enabled SSO providers, e.g., `google,github,microsoft` |
|
|
48
|
+
|
|
49
|
+
### Supported SSO Providers
|
|
50
|
+
|
|
51
|
+
| Provider | Value | Environment Variables |
|
|
52
|
+
| --------------------- | ----------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
53
|
+
| Google | `google` | `AUTH_GOOGLE_ID`, `AUTH_GOOGLE_SECRET` |
|
|
54
|
+
| GitHub | `github` | `AUTH_GITHUB_ID`, `AUTH_GITHUB_SECRET` |
|
|
55
|
+
| Microsoft | `microsoft` | `AUTH_MICROSOFT_ID`, `AUTH_MICROSOFT_SECRET` |
|
|
56
|
+
| AWS Cognito | `cognito` | `AUTH_COGNITO_ID`, `AUTH_COGNITO_SECRET`, `AUTH_COGNITO_ISSUER` |
|
|
57
|
+
| Auth0 | `auth0` | `AUTH_AUTH0_ID`, `AUTH_AUTH0_SECRET`, `AUTH_AUTH0_ISSUER` |
|
|
58
|
+
| Authelia | `authelia` | `AUTH_AUTHELIA_ID`, `AUTH_AUTHELIA_SECRET`, `AUTH_AUTHELIA_ISSUER` |
|
|
59
|
+
| Authentik | `authentik` | `AUTH_AUTHENTIK_ID`, `AUTH_AUTHENTIK_SECRET`, `AUTH_AUTHENTIK_ISSUER` |
|
|
60
|
+
| Casdoor | `casdoor` | `AUTH_CASDOOR_ID`, `AUTH_CASDOOR_SECRET`, `AUTH_CASDOOR_ISSUER` |
|
|
61
|
+
| Cloudflare Zero Trust | `cloudflare-zero-trust` | `AUTH_CLOUDFLARE_ZERO_TRUST_ID`, `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET`, `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` |
|
|
62
|
+
| Keycloak | `keycloak` | `AUTH_KEYCLOAK_ID`, `AUTH_KEYCLOAK_SECRET`, `AUTH_KEYCLOAK_ISSUER` |
|
|
63
|
+
| Logto | `logto` | `AUTH_LOGTO_ID`, `AUTH_LOGTO_SECRET`, `AUTH_LOGTO_ISSUER` |
|
|
64
|
+
| Okta | `okta` | `AUTH_OKTA_ID`, `AUTH_OKTA_SECRET`, `AUTH_OKTA_ISSUER` |
|
|
65
|
+
| ZITADEL | `zitadel` | `AUTH_ZITADEL_ID`, `AUTH_ZITADEL_SECRET`, `AUTH_ZITADEL_ISSUER` |
|
|
66
|
+
| Generic OIDC | `generic-oidc` | `AUTH_GENERIC_OIDC_ID`, `AUTH_GENERIC_OIDC_SECRET`, `AUTH_GENERIC_OIDC_ISSUER` |
|
|
67
|
+
| Feishu | `feishu` | `AUTH_FEISHU_APP_ID`, `AUTH_FEISHU_APP_SECRET` |
|
|
68
|
+
| WeChat | `wechat` | `AUTH_WECHAT_ID`, `AUTH_WECHAT_SECRET` |
|
|
69
|
+
|
|
70
|
+
### Callback URL Format
|
|
71
|
+
|
|
72
|
+
When configuring OAuth providers, use the following callback URL format:
|
|
73
|
+
|
|
74
|
+
- **Development**: `http://localhost:3210/api/auth/callback/{provider}`
|
|
75
|
+
- **Production**: `https://yourdomain.com/api/auth/callback/{provider}`
|
|
76
|
+
|
|
77
|
+
### Email Service Configuration
|
|
78
|
+
|
|
79
|
+
If you want to enable email verification or password reset features, you need to configure SMTP settings:
|
|
80
|
+
|
|
81
|
+
| Environment Variable | Type | Description |
|
|
82
|
+
| ------------------------------------- | -------- | ----------------------------------------------------------------- |
|
|
83
|
+
| `NEXT_PUBLIC_AUTH_EMAIL_VERIFICATION` | Optional | Set to `1` to require email verification before users can sign in |
|
|
84
|
+
| `SMTP_HOST` | Required | SMTP server hostname (e.g., `smtp.gmail.com`) |
|
|
85
|
+
| `SMTP_PORT` | Required | SMTP server port (usually `587` for TLS, `465` for SSL) |
|
|
86
|
+
| `SMTP_SECURE` | Optional | Set to `true` for SSL (port 465), `false` for TLS (port 587) |
|
|
87
|
+
| `SMTP_USER` | Required | SMTP authentication username |
|
|
88
|
+
| `SMTP_PASS` | Required | SMTP authentication password |
|
|
89
|
+
|
|
90
|
+
<Callout type={'tip'}>
|
|
91
|
+
For detailed provider configuration, refer to the [Next Auth provider documentation](/docs/self-hosting/advanced/auth/next-auth) as most configurations are compatible, or visit the official [Better Auth documentation](https://www.better-auth.com/docs/introduction).
|
|
92
|
+
</Callout>
|
|
93
|
+
|
|
94
|
+
<Callout type={'tip'}>
|
|
95
|
+
Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#better-auth) for detailed information on all Better Auth variables.
|
|
96
|
+
</Callout>
|
|
97
|
+
|
|
25
98
|
## Next Auth
|
|
26
99
|
|
|
27
100
|
Before using NextAuth, please set the following variables in LobeChat's environment variables:
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: LobeChat 身份验证服务配置
|
|
3
|
-
description: 了解如何使用 Clerk 或 Next Auth 配置外部身份验证服务,以统一管理用户授权。支持的身份验证服务包括 Auth0、 Azure ID 等。
|
|
3
|
+
description: 了解如何使用 Better Auth、Clerk 或 Next Auth 配置外部身份验证服务,以统一管理用户授权。支持的身份验证服务包括 Auth0、 Azure ID 等。
|
|
4
4
|
tags:
|
|
5
5
|
- 身份验证服务
|
|
6
|
+
- Better Auth
|
|
6
7
|
- LobeChat
|
|
7
8
|
- SSO
|
|
8
9
|
- Clerk
|
|
@@ -10,7 +11,7 @@ tags:
|
|
|
10
11
|
|
|
11
12
|
# 身份验证服务
|
|
12
13
|
|
|
13
|
-
LobeChat 支持使用 Clerk 或者 Next Auth 配置外部身份验证服务,供企业 / 组织内部使用,统一管理用户授权。
|
|
14
|
+
LobeChat 支持使用 Better Auth、Clerk 或者 Next Auth 配置外部身份验证服务,供企业 / 组织内部使用,统一管理用户授权。
|
|
14
15
|
|
|
15
16
|
## Clerk
|
|
16
17
|
|
|
@@ -20,6 +21,78 @@ LobeChat 与 Clerk 做了深度集成,能够为用户提供一个更加安全
|
|
|
20
21
|
|
|
21
22
|
在 LobeChat 的环境变量中设置 `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` 和 `CLERK_SECRET_KEY`,即可开启和使用 Clerk。
|
|
22
23
|
|
|
24
|
+
## Better Auth
|
|
25
|
+
|
|
26
|
+
[Better Auth](https://www.better-auth.com) 是一个现代化、框架无关的身份验证库,旨在提供全面、安全、灵活的身份验证解决方案。它支持多种认证方式,包括邮箱 / 密码登录、魔法链接登录以及多种 OAuth/SSO 提供商。
|
|
27
|
+
|
|
28
|
+
### 主要特性
|
|
29
|
+
|
|
30
|
+
- **邮箱 / 密码认证**:内置支持传统的邮箱和密码登录,采用安全的密码哈希算法
|
|
31
|
+
- **邮箱验证**:可选的邮箱验证流程,支持自定义邮件模板
|
|
32
|
+
- **魔法链接登录**:通过邮件魔法链接实现无密码认证
|
|
33
|
+
- **OAuth/SSO 支持**:集成 Google、GitHub、Microsoft、AWS Cognito 等主流身份提供商
|
|
34
|
+
- **通用 OIDC/OAuth**:支持任何符合 OpenID Connect 或 OAuth 2.0 标准的提供商
|
|
35
|
+
|
|
36
|
+
### 快速开始
|
|
37
|
+
|
|
38
|
+
要在 LobeChat 中启用 Better Auth,请设置以下环境变量:
|
|
39
|
+
|
|
40
|
+
| 环境变量 | 类型 | 描述 |
|
|
41
|
+
| -------------------------------- | -- | ------------------------------------------------ |
|
|
42
|
+
| `NEXT_PUBLIC_ENABLE_BETTER_AUTH` | 必选 | 设置为 `1` 以启用 Better Auth 服务 |
|
|
43
|
+
| `AUTH_SECRET` | 必选 | 用于加密会话令牌的密钥。使用以下命令生成:`openssl rand -base64 32` |
|
|
44
|
+
| `NEXT_PUBLIC_AUTH_URL` | 可选 | 浏览器可访问的 Better Auth 回调 URL。仅在默认生成的 URL 不正确时设置 |
|
|
45
|
+
| `AUTH_SSO_PROVIDERS` | 可选 | 启用的 SSO 提供商列表,以逗号分隔,例如 `google,github,microsoft` |
|
|
46
|
+
|
|
47
|
+
### 支持的 SSO 提供商
|
|
48
|
+
|
|
49
|
+
| 提供商 | 值 | 环境变量 |
|
|
50
|
+
| --------------------- | ----------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| Google | `google` | `AUTH_GOOGLE_ID`, `AUTH_GOOGLE_SECRET` |
|
|
52
|
+
| GitHub | `github` | `AUTH_GITHUB_ID`, `AUTH_GITHUB_SECRET` |
|
|
53
|
+
| Microsoft | `microsoft` | `AUTH_MICROSOFT_ID`, `AUTH_MICROSOFT_SECRET` |
|
|
54
|
+
| AWS Cognito | `cognito` | `AUTH_COGNITO_ID`, `AUTH_COGNITO_SECRET`, `AUTH_COGNITO_ISSUER` |
|
|
55
|
+
| Auth0 | `auth0` | `AUTH_AUTH0_ID`, `AUTH_AUTH0_SECRET`, `AUTH_AUTH0_ISSUER` |
|
|
56
|
+
| Authelia | `authelia` | `AUTH_AUTHELIA_ID`, `AUTH_AUTHELIA_SECRET`, `AUTH_AUTHELIA_ISSUER` |
|
|
57
|
+
| Authentik | `authentik` | `AUTH_AUTHENTIK_ID`, `AUTH_AUTHENTIK_SECRET`, `AUTH_AUTHENTIK_ISSUER` |
|
|
58
|
+
| Casdoor | `casdoor` | `AUTH_CASDOOR_ID`, `AUTH_CASDOOR_SECRET`, `AUTH_CASDOOR_ISSUER` |
|
|
59
|
+
| Cloudflare Zero Trust | `cloudflare-zero-trust` | `AUTH_CLOUDFLARE_ZERO_TRUST_ID`, `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET`, `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` |
|
|
60
|
+
| Keycloak | `keycloak` | `AUTH_KEYCLOAK_ID`, `AUTH_KEYCLOAK_SECRET`, `AUTH_KEYCLOAK_ISSUER` |
|
|
61
|
+
| Logto | `logto` | `AUTH_LOGTO_ID`, `AUTH_LOGTO_SECRET`, `AUTH_LOGTO_ISSUER` |
|
|
62
|
+
| Okta | `okta` | `AUTH_OKTA_ID`, `AUTH_OKTA_SECRET`, `AUTH_OKTA_ISSUER` |
|
|
63
|
+
| ZITADEL | `zitadel` | `AUTH_ZITADEL_ID`, `AUTH_ZITADEL_SECRET`, `AUTH_ZITADEL_ISSUER` |
|
|
64
|
+
| Generic OIDC | `generic-oidc` | `AUTH_GENERIC_OIDC_ID`, `AUTH_GENERIC_OIDC_SECRET`, `AUTH_GENERIC_OIDC_ISSUER` |
|
|
65
|
+
| 飞书 | `feishu` | `AUTH_FEISHU_APP_ID`, `AUTH_FEISHU_APP_SECRET` |
|
|
66
|
+
| 微信 | `wechat` | `AUTH_WECHAT_ID`, `AUTH_WECHAT_SECRET` |
|
|
67
|
+
|
|
68
|
+
### 回调 URL 格式
|
|
69
|
+
|
|
70
|
+
配置 OAuth 提供商时,请使用以下回调 URL 格式:
|
|
71
|
+
|
|
72
|
+
- **开发环境**:`http://localhost:3210/api/auth/callback/{provider}`
|
|
73
|
+
- **生产环境**:`https://yourdomain.com/api/auth/callback/{provider}`
|
|
74
|
+
|
|
75
|
+
### 邮件服务配置
|
|
76
|
+
|
|
77
|
+
如果需要启用邮箱验证或密码重置功能,需要配置 SMTP 设置:
|
|
78
|
+
|
|
79
|
+
| 环境变量 | 类型 | 描述 |
|
|
80
|
+
| ------------------------------------- | -- | ---------------------------------------------- |
|
|
81
|
+
| `NEXT_PUBLIC_AUTH_EMAIL_VERIFICATION` | 可选 | 设置为 `1` 以要求用户在登录前验证邮箱 |
|
|
82
|
+
| `SMTP_HOST` | 必选 | SMTP 服务器主机名(例如 `smtp.gmail.com`) |
|
|
83
|
+
| `SMTP_PORT` | 必选 | SMTP 服务器端口(TLS 通常为 `587`,SSL 为 `465`) |
|
|
84
|
+
| `SMTP_SECURE` | 可选 | SSL 设置为 `true`(端口 465),TLS 设置为 `false`(端口 587) |
|
|
85
|
+
| `SMTP_USER` | 必选 | SMTP 认证用户名 |
|
|
86
|
+
| `SMTP_PASS` | 必选 | SMTP 认证密码 |
|
|
87
|
+
|
|
88
|
+
<Callout type={'tip'}>
|
|
89
|
+
详细的提供商配置可参考 [Next Auth 提供商文档](/zh/docs/self-hosting/advanced/auth/next-auth)(大部分配置兼容),或访问官方 [Better Auth 文档](https://www.better-auth.com/docs/introduction)。
|
|
90
|
+
</Callout>
|
|
91
|
+
|
|
92
|
+
<Callout type={'tip'}>
|
|
93
|
+
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#better-auth) 可查阅所有 Better Auth 相关变量详情。
|
|
94
|
+
</Callout>
|
|
95
|
+
|
|
23
96
|
## Next Auth
|
|
24
97
|
|
|
25
98
|
在使用 NextAuth 之前,请先在 LobeChat 的环境变量中设置以下变量:
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: LobeChat Authentication Service Environment Variables
|
|
3
3
|
description: >-
|
|
4
|
-
Explore the essential environment variables for configuring authentication services in LobeChat, including OAuth SSO, NextAuth settings, and provider-specific details.
|
|
4
|
+
Explore the essential environment variables for configuring authentication services in LobeChat, including Better Auth, OAuth SSO, NextAuth settings, and provider-specific details.
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
tags:
|
|
8
8
|
- Authentication Service
|
|
9
|
+
- Better Auth
|
|
9
10
|
- OAuth SSO
|
|
10
11
|
- Clerk
|
|
11
12
|
- NextAuth
|
|
@@ -15,6 +16,191 @@ tags:
|
|
|
15
16
|
|
|
16
17
|
LobeChat provides a complete authentication service capability when deployed. The following are the relevant environment variables. You can use these environment variables to easily define the identity verification services that need to be enabled in LobeChat.
|
|
17
18
|
|
|
19
|
+
## Better Auth
|
|
20
|
+
|
|
21
|
+
### General Settings
|
|
22
|
+
|
|
23
|
+
#### `NEXT_PUBLIC_ENABLE_BETTER_AUTH`
|
|
24
|
+
|
|
25
|
+
- Type: Required
|
|
26
|
+
- Description: Set to `1` to enable Better Auth service. When enabled, Better Auth will be used for authentication instead of Next Auth or Clerk.
|
|
27
|
+
- Default: `-`
|
|
28
|
+
- Example: `1`
|
|
29
|
+
|
|
30
|
+
#### `AUTH_SECRET`
|
|
31
|
+
|
|
32
|
+
- Type: Required
|
|
33
|
+
- Description: Key used to encrypt session tokens. Shared between Better Auth and Next Auth. You can generate the key using the command: `openssl rand -base64 32`.
|
|
34
|
+
- Default: `-`
|
|
35
|
+
- Example: `Tfhi2t2pelSMEA8eaV61KaqPNEndFFdMIxDaJnS1CUI=`
|
|
36
|
+
|
|
37
|
+
#### `NEXT_PUBLIC_AUTH_URL`
|
|
38
|
+
|
|
39
|
+
- Type: Optional
|
|
40
|
+
- Description: The URL accessible from the browser for Better Auth callbacks. Only set this if the default generated URL is incorrect.
|
|
41
|
+
- Default: `-`
|
|
42
|
+
- Example: `https://example.com`
|
|
43
|
+
|
|
44
|
+
#### `NEXT_PUBLIC_AUTH_EMAIL_VERIFICATION`
|
|
45
|
+
|
|
46
|
+
- Type: Optional
|
|
47
|
+
- Description: Set to `1` to require email verification before users can sign in. Users must verify their email address after registration.
|
|
48
|
+
- Default: `0`
|
|
49
|
+
- Example: `1`
|
|
50
|
+
|
|
51
|
+
#### `AUTH_SSO_PROVIDERS`
|
|
52
|
+
|
|
53
|
+
- Type: Optional
|
|
54
|
+
- Description: Comma-separated list of enabled SSO providers. The order determines the display order of providers on the login page.
|
|
55
|
+
- Default: `-`
|
|
56
|
+
- Example: `google,github,microsoft,cognito`
|
|
57
|
+
|
|
58
|
+
### Email Service (SMTP)
|
|
59
|
+
|
|
60
|
+
These settings are required for email verification and password reset features.
|
|
61
|
+
|
|
62
|
+
#### `SMTP_HOST`
|
|
63
|
+
|
|
64
|
+
- Type: Required (for email features)
|
|
65
|
+
- Description: SMTP server hostname.
|
|
66
|
+
- Default: `-`
|
|
67
|
+
- Example: `smtp.gmail.com`
|
|
68
|
+
|
|
69
|
+
#### `SMTP_PORT`
|
|
70
|
+
|
|
71
|
+
- Type: Required (for email features)
|
|
72
|
+
- Description: SMTP server port. Usually `587` for TLS or `465` for SSL.
|
|
73
|
+
- Default: `-`
|
|
74
|
+
- Example: `587`
|
|
75
|
+
|
|
76
|
+
#### `SMTP_SECURE`
|
|
77
|
+
|
|
78
|
+
- Type: Optional
|
|
79
|
+
- Description: Use secure connection. Set to `true` for port 465 (SSL), `false` for port 587 (TLS).
|
|
80
|
+
- Default: `false`
|
|
81
|
+
- Example: `false`
|
|
82
|
+
|
|
83
|
+
#### `SMTP_USER`
|
|
84
|
+
|
|
85
|
+
- Type: Required (for email features)
|
|
86
|
+
- Description: SMTP authentication username, usually your email address.
|
|
87
|
+
- Default: `-`
|
|
88
|
+
- Example: `your-email@example.com`
|
|
89
|
+
|
|
90
|
+
#### `SMTP_PASS`
|
|
91
|
+
|
|
92
|
+
- Type: Required (for email features)
|
|
93
|
+
- Description: SMTP authentication password. For Gmail, use an app-specific password.
|
|
94
|
+
- Default: `-`
|
|
95
|
+
- Example: `your-app-specific-password`
|
|
96
|
+
|
|
97
|
+
### Google
|
|
98
|
+
|
|
99
|
+
#### `AUTH_GOOGLE_ID`
|
|
100
|
+
|
|
101
|
+
- Type: Required
|
|
102
|
+
- Description: Client ID of the Google OAuth application. Get it from [Google Cloud Console](https://console.cloud.google.com/apis/credentials).
|
|
103
|
+
- Default: `-`
|
|
104
|
+
- Example: `123456789.apps.googleusercontent.com`
|
|
105
|
+
|
|
106
|
+
#### `AUTH_GOOGLE_SECRET`
|
|
107
|
+
|
|
108
|
+
- Type: Required
|
|
109
|
+
- Description: Client Secret of the Google OAuth application.
|
|
110
|
+
- Default: `-`
|
|
111
|
+
- Example: `GOCSPX-xxxxxxxxxxxxxxxxxxxx`
|
|
112
|
+
|
|
113
|
+
### GitHub
|
|
114
|
+
|
|
115
|
+
#### `AUTH_GITHUB_ID`
|
|
116
|
+
|
|
117
|
+
- Type: Required
|
|
118
|
+
- Description: Client ID of the GitHub OAuth application. Get it from [GitHub Developer Settings](https://github.com/settings/developers).
|
|
119
|
+
- Default: `-`
|
|
120
|
+
- Example: `Ov23xxxxxxxxxxxxx`
|
|
121
|
+
|
|
122
|
+
#### `AUTH_GITHUB_SECRET`
|
|
123
|
+
|
|
124
|
+
- Type: Required
|
|
125
|
+
- Description: Client Secret of the GitHub OAuth application.
|
|
126
|
+
- Default: `-`
|
|
127
|
+
- Example: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
128
|
+
|
|
129
|
+
### Microsoft
|
|
130
|
+
|
|
131
|
+
#### `AUTH_MICROSOFT_ID`
|
|
132
|
+
|
|
133
|
+
- Type: Required
|
|
134
|
+
- Description: Client ID of the Microsoft Entra ID (Azure AD) application. Get it from [Azure Portal](https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade).
|
|
135
|
+
- Default: `-`
|
|
136
|
+
- Example: `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
|
|
137
|
+
|
|
138
|
+
#### `AUTH_MICROSOFT_SECRET`
|
|
139
|
+
|
|
140
|
+
- Type: Required
|
|
141
|
+
- Description: Client Secret of the Microsoft Entra ID application.
|
|
142
|
+
- Default: `-`
|
|
143
|
+
- Example: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
144
|
+
|
|
145
|
+
### AWS Cognito
|
|
146
|
+
|
|
147
|
+
#### `AUTH_COGNITO_ID`
|
|
148
|
+
|
|
149
|
+
- Type: Required
|
|
150
|
+
- Description: Client ID of the AWS Cognito User Pool App Client. Get it from [AWS Cognito Console](https://console.aws.amazon.com/cognito).
|
|
151
|
+
- Default: `-`
|
|
152
|
+
- Example: `xxxxxxxxxxxxxxxxxxxxx`
|
|
153
|
+
|
|
154
|
+
#### `AUTH_COGNITO_SECRET`
|
|
155
|
+
|
|
156
|
+
- Type: Required
|
|
157
|
+
- Description: Client Secret of the AWS Cognito App Client.
|
|
158
|
+
- Default: `-`
|
|
159
|
+
- Example: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
160
|
+
|
|
161
|
+
#### `AUTH_COGNITO_ISSUER`
|
|
162
|
+
|
|
163
|
+
- Type: Required
|
|
164
|
+
- Description: The Cognito User Pool issuer URL. Format: `https://cognito-idp.{region}.amazonaws.com/{userPoolId}`
|
|
165
|
+
- Default: `-`
|
|
166
|
+
- Example: `https://cognito-idp.us-east-1.amazonaws.com/us-east-1_xxxxxxxxx`
|
|
167
|
+
|
|
168
|
+
### Feishu
|
|
169
|
+
|
|
170
|
+
#### `AUTH_FEISHU_APP_ID`
|
|
171
|
+
|
|
172
|
+
- Type: Required
|
|
173
|
+
- Description: App ID of the Feishu application. Get it from [Feishu Open Platform](https://open.feishu.cn/app).
|
|
174
|
+
- Default: `-`
|
|
175
|
+
- Example: `cli_xxxxxxxxxxxxxxxx`
|
|
176
|
+
|
|
177
|
+
#### `AUTH_FEISHU_APP_SECRET`
|
|
178
|
+
|
|
179
|
+
- Type: Required
|
|
180
|
+
- Description: App Secret of the Feishu application.
|
|
181
|
+
- Default: `-`
|
|
182
|
+
- Example: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
183
|
+
|
|
184
|
+
### WeChat
|
|
185
|
+
|
|
186
|
+
#### `AUTH_WECHAT_ID`
|
|
187
|
+
|
|
188
|
+
- Type: Required
|
|
189
|
+
- Description: App ID of the WeChat Open Platform application. Get it from [WeChat Open Platform](https://open.weixin.qq.com/).
|
|
190
|
+
- Default: `-`
|
|
191
|
+
- Example: `wxxxxxxxxxxxxxxxxxxx`
|
|
192
|
+
|
|
193
|
+
#### `AUTH_WECHAT_SECRET`
|
|
194
|
+
|
|
195
|
+
- Type: Required
|
|
196
|
+
- Description: App Secret of the WeChat application.
|
|
197
|
+
- Default: `-`
|
|
198
|
+
- Example: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
199
|
+
|
|
200
|
+
<Callout type={'info'}>
|
|
201
|
+
For other OIDC-based providers (Auth0, Authelia, Authentik, Casdoor, Cloudflare Zero Trust, Keycloak, Logto, Okta, ZITADEL, Generic OIDC), the environment variables follow the same pattern as Next Auth. See the [Next Auth section](#next-auth) below for details.
|
|
202
|
+
</Callout>
|
|
203
|
+
|
|
18
204
|
## Next Auth
|
|
19
205
|
|
|
20
206
|
### General Settings
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: LobeChat 身份验证服务设置
|
|
3
|
-
description: 了解如何配置 LobeChat
|
|
3
|
+
description: 了解如何配置 LobeChat 的身份验证服务环境变量,包括 Better Auth、OAuth SSO、NextAuth 设置等。
|
|
4
4
|
tags:
|
|
5
5
|
- LobeChat
|
|
6
6
|
- 身份验证服务
|
|
7
|
+
- Better Auth
|
|
7
8
|
- 单点登录
|
|
8
9
|
- Next Auth
|
|
9
10
|
- Clerk
|
|
@@ -13,6 +14,191 @@ tags:
|
|
|
13
14
|
|
|
14
15
|
LobeChat 在部署时提供了完善的身份验证服务能力,以下是相关的环境变量,你可以使用这些环境变量轻松定义需要在 LobeChat 中开启的身份验证服务。
|
|
15
16
|
|
|
17
|
+
## Better Auth
|
|
18
|
+
|
|
19
|
+
### 通用设置
|
|
20
|
+
|
|
21
|
+
#### `NEXT_PUBLIC_ENABLE_BETTER_AUTH`
|
|
22
|
+
|
|
23
|
+
- 类型:必选
|
|
24
|
+
- 描述:设置为 `1` 以启用 Better Auth 服务。启用后,将使用 Better Auth 进行身份验证,而非 Next Auth 或 Clerk。
|
|
25
|
+
- 默认值:`-`
|
|
26
|
+
- 示例:`1`
|
|
27
|
+
|
|
28
|
+
#### `AUTH_SECRET`
|
|
29
|
+
|
|
30
|
+
- 类型:必选
|
|
31
|
+
- 描述:用于加密会话令牌的密钥,Better Auth 和 Next Auth 共享。使用以下命令生成:`openssl rand -base64 32`
|
|
32
|
+
- 默认值:`-`
|
|
33
|
+
- 示例:`Tfhi2t2pelSMEA8eaV61KaqPNEndFFdMIxDaJnS1CUI=`
|
|
34
|
+
|
|
35
|
+
#### `NEXT_PUBLIC_AUTH_URL`
|
|
36
|
+
|
|
37
|
+
- 类型:可选
|
|
38
|
+
- 描述:浏览器可访问的 Better Auth 回调 URL。仅在默认生成的 URL 不正确时设置。
|
|
39
|
+
- 默认值:`-`
|
|
40
|
+
- 示例:`https://example.com`
|
|
41
|
+
|
|
42
|
+
#### `NEXT_PUBLIC_AUTH_EMAIL_VERIFICATION`
|
|
43
|
+
|
|
44
|
+
- 类型:可选
|
|
45
|
+
- 描述:设置为 `1` 以要求用户在登录前验证邮箱。用户注册后必须验证邮箱地址。
|
|
46
|
+
- 默认值:`0`
|
|
47
|
+
- 示例:`1`
|
|
48
|
+
|
|
49
|
+
#### `AUTH_SSO_PROVIDERS`
|
|
50
|
+
|
|
51
|
+
- 类型:可选
|
|
52
|
+
- 描述:启用的 SSO 提供商列表,以逗号分隔。顺序决定了登录页面上提供商的显示顺序。
|
|
53
|
+
- 默认值:`-`
|
|
54
|
+
- 示例:`google,github,microsoft,cognito`
|
|
55
|
+
|
|
56
|
+
### 邮件服务(SMTP)
|
|
57
|
+
|
|
58
|
+
启用邮箱验证和密码重置功能需要配置以下设置。
|
|
59
|
+
|
|
60
|
+
#### `SMTP_HOST`
|
|
61
|
+
|
|
62
|
+
- 类型:必选(用于邮件功能)
|
|
63
|
+
- 描述:SMTP 服务器主机名。
|
|
64
|
+
- 默认值:`-`
|
|
65
|
+
- 示例:`smtp.gmail.com`
|
|
66
|
+
|
|
67
|
+
#### `SMTP_PORT`
|
|
68
|
+
|
|
69
|
+
- 类型:必选(用于邮件功能)
|
|
70
|
+
- 描述:SMTP 服务器端口。TLS 通常为 `587`,SSL 为 `465`。
|
|
71
|
+
- 默认值:`-`
|
|
72
|
+
- 示例:`587`
|
|
73
|
+
|
|
74
|
+
#### `SMTP_SECURE`
|
|
75
|
+
|
|
76
|
+
- 类型:可选
|
|
77
|
+
- 描述:是否使用安全连接。端口 465(SSL)设置为 `true`,端口 587(TLS)设置为 `false`。
|
|
78
|
+
- 默认值:`false`
|
|
79
|
+
- 示例:`false`
|
|
80
|
+
|
|
81
|
+
#### `SMTP_USER`
|
|
82
|
+
|
|
83
|
+
- 类型:必选(用于邮件功能)
|
|
84
|
+
- 描述:SMTP 认证用户名,通常是您的邮箱地址。
|
|
85
|
+
- 默认值:`-`
|
|
86
|
+
- 示例:`your-email@example.com`
|
|
87
|
+
|
|
88
|
+
#### `SMTP_PASS`
|
|
89
|
+
|
|
90
|
+
- 类型:必选(用于邮件功能)
|
|
91
|
+
- 描述:SMTP 认证密码。Gmail 需使用应用专用密码。
|
|
92
|
+
- 默认值:`-`
|
|
93
|
+
- 示例:`your-app-specific-password`
|
|
94
|
+
|
|
95
|
+
### Google
|
|
96
|
+
|
|
97
|
+
#### `AUTH_GOOGLE_ID`
|
|
98
|
+
|
|
99
|
+
- 类型:必选
|
|
100
|
+
- 描述:Google OAuth 应用的 Client ID。在 [Google Cloud Console](https://console.cloud.google.com/apis/credentials) 获取。
|
|
101
|
+
- 默认值:`-`
|
|
102
|
+
- 示例:`123456789.apps.googleusercontent.com`
|
|
103
|
+
|
|
104
|
+
#### `AUTH_GOOGLE_SECRET`
|
|
105
|
+
|
|
106
|
+
- 类型:必选
|
|
107
|
+
- 描述:Google OAuth 应用的 Client Secret。
|
|
108
|
+
- 默认值:`-`
|
|
109
|
+
- 示例:`GOCSPX-xxxxxxxxxxxxxxxxxxxx`
|
|
110
|
+
|
|
111
|
+
### GitHub
|
|
112
|
+
|
|
113
|
+
#### `AUTH_GITHUB_ID`
|
|
114
|
+
|
|
115
|
+
- 类型:必选
|
|
116
|
+
- 描述:GitHub OAuth 应用的 Client ID。在 [GitHub Developer Settings](https://github.com/settings/developers) 获取。
|
|
117
|
+
- 默认值:`-`
|
|
118
|
+
- 示例:`Ov23xxxxxxxxxxxxx`
|
|
119
|
+
|
|
120
|
+
#### `AUTH_GITHUB_SECRET`
|
|
121
|
+
|
|
122
|
+
- 类型:必选
|
|
123
|
+
- 描述:GitHub OAuth 应用的 Client Secret。
|
|
124
|
+
- 默认值:`-`
|
|
125
|
+
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
126
|
+
|
|
127
|
+
### Microsoft
|
|
128
|
+
|
|
129
|
+
#### `AUTH_MICROSOFT_ID`
|
|
130
|
+
|
|
131
|
+
- 类型:必选
|
|
132
|
+
- 描述:Microsoft Entra ID(Azure AD)应用的 Client ID。在 [Azure 门户](https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade) 获取。
|
|
133
|
+
- 默认值:`-`
|
|
134
|
+
- 示例:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
|
|
135
|
+
|
|
136
|
+
#### `AUTH_MICROSOFT_SECRET`
|
|
137
|
+
|
|
138
|
+
- 类型:必选
|
|
139
|
+
- 描述:Microsoft Entra ID 应用的 Client Secret。
|
|
140
|
+
- 默认值:`-`
|
|
141
|
+
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
142
|
+
|
|
143
|
+
### AWS Cognito
|
|
144
|
+
|
|
145
|
+
#### `AUTH_COGNITO_ID`
|
|
146
|
+
|
|
147
|
+
- 类型:必选
|
|
148
|
+
- 描述:AWS Cognito 用户池应用客户端的 Client ID。在 [AWS Cognito 控制台](https://console.aws.amazon.com/cognito) 获取。
|
|
149
|
+
- 默认值:`-`
|
|
150
|
+
- 示例:`xxxxxxxxxxxxxxxxxxxxx`
|
|
151
|
+
|
|
152
|
+
#### `AUTH_COGNITO_SECRET`
|
|
153
|
+
|
|
154
|
+
- 类型:必选
|
|
155
|
+
- 描述:AWS Cognito 应用客户端的 Client Secret。
|
|
156
|
+
- 默认值:`-`
|
|
157
|
+
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
158
|
+
|
|
159
|
+
#### `AUTH_COGNITO_ISSUER`
|
|
160
|
+
|
|
161
|
+
- 类型:必选
|
|
162
|
+
- 描述:Cognito 用户池的颁发者 URL。格式:`https://cognito-idp.{region}.amazonaws.com/{userPoolId}`
|
|
163
|
+
- 默认值:`-`
|
|
164
|
+
- 示例:`https://cognito-idp.us-east-1.amazonaws.com/us-east-1_xxxxxxxxx`
|
|
165
|
+
|
|
166
|
+
### 飞书
|
|
167
|
+
|
|
168
|
+
#### `AUTH_FEISHU_APP_ID`
|
|
169
|
+
|
|
170
|
+
- 类型:必选
|
|
171
|
+
- 描述:飞书应用的 App ID。在 [飞书开放平台](https://open.feishu.cn/app) 获取。
|
|
172
|
+
- 默认值:`-`
|
|
173
|
+
- 示例:`cli_xxxxxxxxxxxxxxxx`
|
|
174
|
+
|
|
175
|
+
#### `AUTH_FEISHU_APP_SECRET`
|
|
176
|
+
|
|
177
|
+
- 类型:必选
|
|
178
|
+
- 描述:飞书应用的 App Secret。
|
|
179
|
+
- 默认值:`-`
|
|
180
|
+
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
181
|
+
|
|
182
|
+
### 微信
|
|
183
|
+
|
|
184
|
+
#### `AUTH_WECHAT_ID`
|
|
185
|
+
|
|
186
|
+
- 类型:必选
|
|
187
|
+
- 描述:微信开放平台应用的 App ID。在 [微信开放平台](https://open.weixin.qq.com/) 获取。
|
|
188
|
+
- 默认值:`-`
|
|
189
|
+
- 示例:`wxxxxxxxxxxxxxxxxxxx`
|
|
190
|
+
|
|
191
|
+
#### `AUTH_WECHAT_SECRET`
|
|
192
|
+
|
|
193
|
+
- 类型:必选
|
|
194
|
+
- 描述:微信应用的 App Secret。
|
|
195
|
+
- 默认值:`-`
|
|
196
|
+
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
|
|
197
|
+
|
|
198
|
+
<Callout type={'info'}>
|
|
199
|
+
其他基于 OIDC 的提供商(Auth0、Authelia、Authentik、Casdoor、Cloudflare Zero Trust、Keycloak、Logto、Okta、ZITADEL、Generic OIDC)的环境变量配置与 Next Auth 相同。详情请参阅下方的 [Next Auth 章节](#next-auth)。
|
|
200
|
+
</Callout>
|
|
201
|
+
|
|
16
202
|
## Next Auth
|
|
17
203
|
|
|
18
204
|
### 通用设置
|