@lobehub/lobehub 2.0.0-next.332 → 2.0.0-next.333

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.
Files changed (209) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/apps/desktop/src/main/const/dir.ts +3 -0
  3. package/apps/desktop/src/main/controllers/SystemCtr.ts +19 -0
  4. package/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts +1 -0
  5. package/apps/desktop/src/main/menus/impls/macOS.test.ts +1 -0
  6. package/changelog/v1.json +12 -0
  7. package/docs/changelog/2023-09-09-plugin-system.mdx +3 -2
  8. package/docs/changelog/2023-11-14-gpt4-vision.mdx +6 -4
  9. package/docs/changelog/2023-11-19-tts-stt.mdx +3 -2
  10. package/docs/changelog/2023-12-22-dalle-3.mdx +5 -2
  11. package/docs/changelog/2023-12-22-dalle-3.zh-CN.mdx +2 -2
  12. package/docs/changelog/2024-02-08-sso-oauth.mdx +2 -2
  13. package/docs/changelog/2024-06-19-lobe-chat-v1.mdx +3 -2
  14. package/docs/changelog/2024-06-19-lobe-chat-v1.zh-CN.mdx +2 -2
  15. package/docs/changelog/2024-07-19-gpt-4o-mini.mdx +3 -2
  16. package/docs/changelog/2024-07-19-gpt-4o-mini.zh-CN.mdx +2 -2
  17. package/docs/changelog/2024-08-02-lobe-chat-database-docker.mdx +3 -2
  18. package/docs/changelog/2024-08-21-file-upload-and-knowledge-base.mdx +5 -4
  19. package/docs/changelog/2024-09-13-openai-o1-models.mdx +2 -2
  20. package/docs/changelog/2024-09-20-artifacts.mdx +3 -2
  21. package/docs/changelog/2024-09-20-artifacts.zh-CN.mdx +2 -2
  22. package/docs/changelog/2024-10-27-pin-assistant.mdx +3 -2
  23. package/docs/changelog/2024-11-06-share-text-json.mdx +4 -2
  24. package/docs/changelog/2024-11-06-share-text-json.zh-CN.mdx +2 -2
  25. package/docs/changelog/2024-11-25-november-providers.mdx +2 -2
  26. package/docs/changelog/2024-11-27-forkable-chat.mdx +2 -2
  27. package/docs/changelog/2025-01-03-user-profile.mdx +2 -2
  28. package/docs/changelog/2025-01-22-new-ai-provider.mdx +2 -2
  29. package/docs/changelog/2025-02-02-deepseek-r1.mdx +4 -4
  30. package/docs/development/basic/add-new-authentication-providers.mdx +4 -0
  31. package/docs/development/basic/add-new-authentication-providers.zh-CN.mdx +4 -0
  32. package/docs/development/basic/add-new-image-model.mdx +4 -0
  33. package/docs/development/basic/add-new-image-model.zh-CN.mdx +4 -0
  34. package/docs/development/basic/architecture.mdx +4 -0
  35. package/docs/development/basic/architecture.zh-CN.mdx +4 -0
  36. package/docs/development/basic/chat-api.mdx +4 -0
  37. package/docs/development/basic/chat-api.zh-CN.mdx +4 -0
  38. package/docs/development/basic/comfyui-development.mdx +3 -1
  39. package/docs/development/basic/contributing-guidelines.mdx +4 -0
  40. package/docs/development/basic/contributing-guidelines.zh-CN.mdx +4 -0
  41. package/docs/development/basic/feature-development-frontend.mdx +11 -3
  42. package/docs/development/basic/feature-development-frontend.zh-CN.mdx +11 -3
  43. package/docs/development/basic/feature-development.mdx +14 -5
  44. package/docs/development/basic/feature-development.zh-CN.mdx +14 -5
  45. package/docs/development/basic/folder-structure.mdx +7 -0
  46. package/docs/development/basic/folder-structure.zh-CN.mdx +7 -0
  47. package/docs/development/basic/resources.mdx +4 -0
  48. package/docs/development/basic/resources.zh-CN.mdx +4 -0
  49. package/docs/development/basic/setup-development.mdx +4 -0
  50. package/docs/development/basic/setup-development.zh-CN.mdx +4 -0
  51. package/docs/development/basic/test.mdx +4 -0
  52. package/docs/development/basic/test.zh-CN.mdx +4 -0
  53. package/docs/development/basic/work-with-server-side-database.mdx +5 -5
  54. package/docs/development/basic/work-with-server-side-database.zh-CN.mdx +5 -5
  55. package/docs/development/internationalization/add-new-locale.mdx +4 -0
  56. package/docs/development/internationalization/add-new-locale.zh-CN.mdx +4 -0
  57. package/docs/development/internationalization/internationalization-implementation.mdx +4 -0
  58. package/docs/development/internationalization/internationalization-implementation.zh-CN.mdx +4 -0
  59. package/docs/development/others/lighthouse.mdx +4 -0
  60. package/docs/development/others/lighthouse.zh-CN.mdx +4 -0
  61. package/docs/development/start.mdx +4 -0
  62. package/docs/development/start.zh-CN.mdx +4 -0
  63. package/docs/development/state-management/state-management-intro.mdx +4 -2
  64. package/docs/development/state-management/state-management-intro.zh-CN.mdx +4 -2
  65. package/docs/development/state-management/state-management-selectors.mdx +6 -1
  66. package/docs/development/state-management/state-management-selectors.zh-CN.mdx +6 -1
  67. package/docs/development/tests/integration-testing.zh-CN.mdx +4 -0
  68. package/docs/self-hosting/advanced/analytics.mdx +2 -2
  69. package/docs/self-hosting/advanced/auth/better-auth/apple.mdx +132 -0
  70. package/docs/self-hosting/advanced/auth/better-auth/apple.zh-CN.mdx +127 -0
  71. package/docs/self-hosting/advanced/auth/better-auth/auth0.mdx +111 -0
  72. package/docs/self-hosting/advanced/auth/better-auth/auth0.zh-CN.mdx +107 -0
  73. package/docs/self-hosting/advanced/auth/better-auth/authelia.mdx +66 -0
  74. package/docs/self-hosting/advanced/auth/better-auth/authelia.zh-CN.mdx +62 -0
  75. package/docs/self-hosting/advanced/auth/better-auth/authentik.mdx +67 -0
  76. package/docs/self-hosting/advanced/auth/better-auth/authentik.zh-CN.mdx +63 -0
  77. package/docs/self-hosting/advanced/auth/better-auth/casdoor.mdx +62 -0
  78. package/docs/self-hosting/advanced/auth/better-auth/casdoor.zh-CN.mdx +58 -0
  79. package/docs/self-hosting/advanced/auth/better-auth/cloudflare-zero-trust.mdx +59 -0
  80. package/docs/self-hosting/advanced/auth/better-auth/cloudflare-zero-trust.zh-CN.mdx +55 -0
  81. package/docs/self-hosting/advanced/auth/better-auth/cognito.mdx +88 -0
  82. package/docs/self-hosting/advanced/auth/better-auth/cognito.zh-CN.mdx +85 -0
  83. package/docs/self-hosting/advanced/auth/better-auth/feishu.mdx +73 -0
  84. package/docs/self-hosting/advanced/auth/better-auth/feishu.zh-CN.mdx +69 -0
  85. package/docs/self-hosting/advanced/auth/better-auth/generic-oidc.mdx +86 -0
  86. package/docs/self-hosting/advanced/auth/better-auth/generic-oidc.zh-CN.mdx +83 -0
  87. package/docs/self-hosting/advanced/auth/better-auth/github.mdx +93 -0
  88. package/docs/self-hosting/advanced/auth/better-auth/github.zh-CN.mdx +90 -0
  89. package/docs/self-hosting/advanced/auth/better-auth/google.mdx +80 -0
  90. package/docs/self-hosting/advanced/auth/better-auth/google.zh-CN.mdx +77 -0
  91. package/docs/self-hosting/advanced/auth/better-auth/keycloak.mdx +77 -0
  92. package/docs/self-hosting/advanced/auth/better-auth/keycloak.zh-CN.mdx +74 -0
  93. package/docs/self-hosting/advanced/auth/better-auth/logto.mdx +64 -0
  94. package/docs/self-hosting/advanced/auth/better-auth/logto.zh-CN.mdx +60 -0
  95. package/docs/self-hosting/advanced/auth/better-auth/microsoft.mdx +113 -0
  96. package/docs/self-hosting/advanced/auth/better-auth/microsoft.zh-CN.mdx +109 -0
  97. package/docs/self-hosting/advanced/auth/better-auth/okta.mdx +67 -0
  98. package/docs/self-hosting/advanced/auth/better-auth/okta.zh-CN.mdx +63 -0
  99. package/docs/self-hosting/advanced/auth/better-auth/wechat.mdx +77 -0
  100. package/docs/self-hosting/advanced/auth/better-auth/wechat.zh-CN.mdx +72 -0
  101. package/docs/self-hosting/advanced/auth/better-auth/zitadel.mdx +73 -0
  102. package/docs/self-hosting/advanced/auth/better-auth/zitadel.zh-CN.mdx +69 -0
  103. package/docs/self-hosting/advanced/auth/clerk.mdx +2 -2
  104. package/docs/self-hosting/advanced/auth/legacy.mdx +106 -0
  105. package/docs/self-hosting/advanced/auth/legacy.zh-CN.mdx +101 -0
  106. package/docs/self-hosting/advanced/auth/next-auth/auth0.mdx +3 -2
  107. package/docs/self-hosting/advanced/auth/next-auth/authelia.mdx +3 -2
  108. package/docs/self-hosting/advanced/auth/next-auth/authentik.mdx +3 -2
  109. package/docs/self-hosting/advanced/auth/next-auth/casdoor.mdx +5 -2
  110. package/docs/self-hosting/advanced/auth/next-auth/casdoor.zh-CN.mdx +2 -0
  111. package/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.mdx +3 -2
  112. package/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.zh-CN.mdx +2 -2
  113. package/docs/self-hosting/advanced/auth/next-auth/github.mdx +3 -2
  114. package/docs/self-hosting/advanced/auth/next-auth/google.mdx +10 -12
  115. package/docs/self-hosting/advanced/auth/next-auth/keycloak.mdx +3 -2
  116. package/docs/self-hosting/advanced/auth/next-auth/logto.mdx +2 -2
  117. package/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id.mdx +3 -2
  118. package/docs/self-hosting/advanced/auth/next-auth/okta.mdx +3 -2
  119. package/docs/self-hosting/advanced/auth/next-auth/okta.zh-CN.mdx +1 -3
  120. package/docs/self-hosting/advanced/auth/next-auth/wechat.mdx +2 -2
  121. package/docs/self-hosting/advanced/auth/next-auth/zitadel.mdx +3 -2
  122. package/docs/self-hosting/advanced/auth.mdx +86 -139
  123. package/docs/self-hosting/advanced/auth.zh-CN.mdx +84 -135
  124. package/docs/self-hosting/advanced/desktop.mdx +9 -3
  125. package/docs/self-hosting/advanced/desktop.zh-CN.mdx +9 -3
  126. package/docs/self-hosting/advanced/feature-flags.mdx +3 -2
  127. package/docs/self-hosting/advanced/knowledge-base.mdx +2 -2
  128. package/docs/self-hosting/advanced/model-list.mdx +2 -2
  129. package/docs/self-hosting/advanced/observability/grafana.mdx +4 -2
  130. package/docs/self-hosting/advanced/observability/grafana.zh-CN.mdx +2 -1
  131. package/docs/self-hosting/advanced/observability/langfuse.mdx +3 -2
  132. package/docs/self-hosting/advanced/online-search.mdx +4 -6
  133. package/docs/self-hosting/advanced/s3/tencent-cloud.mdx +2 -2
  134. package/docs/self-hosting/advanced/settings-url-share.mdx +3 -2
  135. package/docs/self-hosting/advanced/upstream-sync.mdx +3 -4
  136. package/docs/self-hosting/advanced/upstream-sync.zh-CN.mdx +0 -2
  137. package/docs/self-hosting/environment-variables/analytics.mdx +3 -2
  138. package/docs/self-hosting/environment-variables/auth.mdx +5 -12
  139. package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +2 -9
  140. package/docs/self-hosting/environment-variables/basic.mdx +3 -10
  141. package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +0 -7
  142. package/docs/self-hosting/environment-variables/model-provider.mdx +3 -4
  143. package/docs/self-hosting/environment-variables/s3.mdx +2 -2
  144. package/docs/self-hosting/environment-variables.mdx +2 -3
  145. package/docs/self-hosting/examples/azure-openai.mdx +2 -3
  146. package/docs/self-hosting/examples/azure-openai.zh-CN.mdx +0 -1
  147. package/docs/self-hosting/examples/ollama.mdx +3 -2
  148. package/docs/self-hosting/faq/no-v1-suffix.mdx +4 -4
  149. package/docs/self-hosting/faq/proxy-with-unable-to-verify-leaf-signature.mdx +3 -2
  150. package/docs/self-hosting/faq/vercel-ai-image-timeout.mdx +2 -2
  151. package/docs/self-hosting/migration/v2/breaking-changes.mdx +73 -0
  152. package/docs/self-hosting/migration/v2/breaking-changes.zh-CN.mdx +71 -0
  153. package/docs/self-hosting/platform/alibaba-cloud.mdx +2 -7
  154. package/docs/self-hosting/platform/alibaba-cloud.zh-CN.mdx +1 -6
  155. package/docs/self-hosting/platform/btpanel.mdx +4 -2
  156. package/docs/self-hosting/platform/btpanel.zh-CN.mdx +2 -2
  157. package/docs/self-hosting/platform/docker-compose.mdx +3 -3
  158. package/docs/self-hosting/platform/docker-compose.zh-CN.mdx +0 -1
  159. package/docs/self-hosting/platform/docker.mdx +2 -11
  160. package/docs/self-hosting/platform/docker.zh-CN.mdx +0 -8
  161. package/docs/self-hosting/platform/netlify.mdx +5 -17
  162. package/docs/self-hosting/platform/netlify.zh-CN.mdx +3 -17
  163. package/docs/self-hosting/platform/railway.mdx +3 -7
  164. package/docs/self-hosting/platform/railway.zh-CN.mdx +1 -7
  165. package/docs/self-hosting/platform/repocloud.mdx +3 -7
  166. package/docs/self-hosting/platform/repocloud.zh-CN.mdx +1 -6
  167. package/docs/self-hosting/platform/sealos.mdx +2 -7
  168. package/docs/self-hosting/platform/sealos.zh-CN.mdx +1 -6
  169. package/docs/self-hosting/platform/tencentcloud-lighthouse.mdx +2 -7
  170. package/docs/self-hosting/platform/tencentcloud-lighthouse.zh-CN.mdx +1 -6
  171. package/docs/self-hosting/platform/vercel.mdx +4 -9
  172. package/docs/self-hosting/platform/vercel.zh-CN.mdx +3 -8
  173. package/docs/self-hosting/platform/zeabur.mdx +2 -11
  174. package/docs/self-hosting/platform/zeabur.zh-CN.mdx +1 -10
  175. package/docs/self-hosting/server-database/docker-compose.mdx +11 -19
  176. package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +12 -21
  177. package/docs/self-hosting/server-database/docker.mdx +9 -24
  178. package/docs/self-hosting/server-database/docker.zh-CN.mdx +7 -24
  179. package/docs/self-hosting/server-database/dokploy.mdx +27 -25
  180. package/docs/self-hosting/server-database/dokploy.zh-CN.mdx +23 -21
  181. package/docs/self-hosting/server-database/netlify.mdx +2 -2
  182. package/docs/self-hosting/server-database/netlify.zh-CN.mdx +2 -2
  183. package/docs/self-hosting/server-database/railway.mdx +2 -2
  184. package/docs/self-hosting/server-database/repocloud.mdx +2 -2
  185. package/docs/self-hosting/server-database/sealos.mdx +2 -2
  186. package/docs/self-hosting/server-database/vercel.mdx +19 -72
  187. package/docs/self-hosting/server-database/vercel.zh-CN.mdx +17 -68
  188. package/docs/self-hosting/server-database/zeabur.mdx +2 -2
  189. package/docs/self-hosting/server-database.mdx +1 -19
  190. package/docs/self-hosting/server-database.zh-CN.mdx +0 -17
  191. package/docs/self-hosting/start.mdx +2 -2
  192. package/docs/self-hosting/start.zh-CN.mdx +2 -2
  193. package/locales/en-US/desktop-onboarding.json +1 -0
  194. package/locales/zh-CN/desktop-onboarding.json +1 -0
  195. package/package.json +2 -2
  196. package/packages/builtin-tool-cloud-sandbox/src/systemRole.ts +62 -2
  197. package/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/index.ts +2 -0
  198. package/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/multi-tasks-with-summary.json +234 -0
  199. package/packages/conversation-flow/src/__tests__/parse.test.ts +25 -0
  200. package/packages/conversation-flow/src/transformation/ContextTreeBuilder.ts +15 -0
  201. package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +20 -0
  202. package/packages/types/src/serverConfig.ts +0 -1
  203. package/src/app/[variants]/(desktop)/desktop-onboarding/features/LoginStep.tsx +39 -1
  204. package/src/app/[variants]/(main)/settings/common/features/Common/Common.tsx +34 -14
  205. package/src/envs/app.ts +0 -13
  206. package/src/locales/default/desktop-onboarding.ts +1 -0
  207. package/src/server/globalConfig/index.ts +1 -2
  208. package/src/services/electron/system.ts +4 -0
  209. package/src/store/serverConfig/selectors.ts +0 -1
@@ -0,0 +1,106 @@
1
+ ---
2
+ title: Legacy Authentication (NextAuth & Clerk)
3
+ description: >-
4
+ Documentation for legacy authentication methods including NextAuth and Clerk.
5
+ For new deployments, we recommend using Better Auth.
6
+ tags:
7
+ - Authentication Service
8
+ - Next Auth
9
+ - Clerk
10
+ - Legacy
11
+ ---
12
+
13
+ # Legacy Authentication
14
+
15
+ <Callout type={'warning'}>
16
+ **Legacy Notice**: NextAuth and Clerk are legacy authentication methods. For new deployments, we strongly recommend using [Better Auth](/docs/self-hosting/advanced/auth) for its simplicity and flexibility.
17
+ </Callout>
18
+
19
+ This page documents the legacy authentication methods (NextAuth and Clerk) for users who are still using these services.
20
+
21
+ ## Clerk
22
+
23
+ Clerk is a comprehensive identity verification solution that provides a simple yet powerful API and services to handle user authentication and session management.
24
+
25
+ LobeChat has deeply integrated with Clerk to provide users with a secure and convenient login and registration experience.
26
+
27
+ By setting the environment variables `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CLERK_SECRET_KEY` in LobeChat's environment, you can enable and use Clerk.
28
+
29
+ <Callout type={'info'}>
30
+ For detailed Clerk configuration, see [Clerk Configuration Guide](/docs/self-hosting/advanced/auth/clerk).
31
+ </Callout>
32
+
33
+ ## Next Auth
34
+
35
+ Before using NextAuth, please set the following variables in LobeChat's environment variables:
36
+
37
+ | Environment Variable | Type | Description |
38
+ | -------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
39
+ | `NEXT_PUBLIC_ENABLE_NEXT_AUTH` | Required | This is used to enable the NextAuth service. Set it to `1` to enable it; changing this setting requires recompiling the application. Users deploying with the `lobehub/lobe-chat-database` image have this configuration added by default. |
40
+ | `AUTH_SECRET` | Required | The key used to encrypt Auth.js session tokens. You can use the following command: `openssl rand -base64 32`, or visit `https://generate-secret.vercel.app/32` to generate the key. |
41
+ | `AUTH_URL` | Required | This URL specifies the callback address for Auth.js when performing OAuth verification. Set this only if the default generated redirect address is incorrect. `https://example.com/api/auth` |
42
+ | `NEXT_AUTH_SSO_PROVIDERS` | Optional | This environment variable is used to enable multiple identity verification sources simultaneously, separated by commas, for example, `auth0,microsoft-entra-id,authentik`. |
43
+ | `NEXT_AUTH_SSO_SESSION_STRATEGY` | Optional | The session strategy for Auth.js. Options are `jwt` or `database`. Default is `jwt`. |
44
+
45
+ Currently supported identity verification services include:
46
+
47
+ <Cards>
48
+ <Card href={'/docs/self-hosting/advanced/auth/next-auth/auth0'} title={'Auth0'} />
49
+
50
+ <Card href={'/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id'} title={'Microsoft Entra ID'} />
51
+
52
+ <Card href={'/docs/self-hosting/advanced/auth/next-auth/authentik'} title={'Authentik'} />
53
+
54
+ <Card href={'/docs/self-hosting/advanced/auth/next-auth/github'} title={'Github'} />
55
+
56
+ <Card href={'/docs/self-hosting/advanced/auth/next-auth/zitadel'} title={'ZITADEL'} />
57
+
58
+ <Card href={'/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust'} title={'Cloudflare Zero Trust'} />
59
+
60
+ <Card href={'/docs/self-hosting/advanced/auth/next-auth/authelia'} title={'Authelia'} />
61
+
62
+ <Card href={'/docs/self-hosting/advanced/auth/next-auth/logto'} title={'Logto'} />
63
+
64
+ <Card href={'/docs/self-hosting/advanced/auth/next-auth/keycloak'} title={'Keycloak'} />
65
+
66
+ <Card href={'/docs/self-hosting/advanced/auth/next-auth/google'} title={'Google'} />
67
+
68
+ <Card href={'/docs/self-hosting/advanced/auth/next-auth/okta'} title={'Okta'} />
69
+ </Cards>
70
+
71
+ Click on the links to view the corresponding platform's configuration documentation.
72
+
73
+ ## Advanced Configuration
74
+
75
+ To simultaneously enable multiple identity verification sources, please set the `NEXT_AUTH_SSO_PROVIDERS` environment variable, separating them with commas, for example, `auth0,microsoft-entra-id,authentik`.
76
+
77
+ The order corresponds to the display order of the SSO providers.
78
+
79
+ | SSO Provider | Value | Additional Features |
80
+ | --------------------- | ----------------------- | ------------------- |
81
+ | Auth0 | `auth0` | |
82
+ | Authenlia | `authenlia` | |
83
+ | Authentik | `authentik` | |
84
+ | Casdoor | `casdoor` | `Webhook` |
85
+ | Cloudflare Zero Trust | `cloudflare-zero-trust` | |
86
+ | Github | `github` | |
87
+ | Logto | `logto` | `Webhook` |
88
+ | Microsoft Entra ID | `microsoft-entra-id` | |
89
+ | ZITADEL | `zitadel` | |
90
+ | Keycloak | `keycloak` | |
91
+ | Google | `google` | |
92
+ | Okta | `okta` | |
93
+
94
+ ## Additional Features
95
+
96
+ ### Webhook Support
97
+
98
+ Allow LobeChat to receive notifications when user information is updated in the identity provider. Supported providers include Casdoor and Logto. Please refer to the specific provider documentation for configuration details.
99
+
100
+ ### Database Session
101
+
102
+ Allow the session store in database, see also the [Auth.js Session Documentation](https://authjs.dev/concepts/session-strategies#database-session).
103
+
104
+ ## Other SSO Providers
105
+
106
+ Please refer to the [Auth.js](https://authjs.dev/getting-started/authentication/oauth) documentation and feel free to submit a Pull Request.
@@ -0,0 +1,101 @@
1
+ ---
2
+ title: 旧版身份验证(NextAuth 和 Clerk)
3
+ description: 关于 NextAuth 和 Clerk 等旧版身份验证方法的文档。对于新部署,我们建议使用 Better Auth。
4
+ tags:
5
+ - 身份验证服务
6
+ - Next Auth
7
+ - Clerk
8
+ - 旧版
9
+ ---
10
+
11
+ # 旧版身份验证
12
+
13
+ <Callout type={'warning'}>
14
+ **旧版提示**:NextAuth 和 Clerk 是旧版身份验证方案。对于新部署,我们强烈建议使用 [Better Auth](/zh/docs/self-hosting/advanced/auth),它更简洁、更灵活。
15
+ </Callout>
16
+
17
+ 本页面为仍在使用这些服务的用户提供旧版身份验证方案(NextAuth 和 Clerk)的文档。
18
+
19
+ ## Clerk
20
+
21
+ Clerk 是一个全面的身份验证解决方案,它提供了简单而强大的 API 和服务来处理用户认证和会话管理。
22
+
23
+ LobeChat 与 Clerk 做了深度集成,能够为用户提供安全、便捷的登录和注册体验。
24
+
25
+ 在 LobeChat 的环境变量中设置 `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` 和 `CLERK_SECRET_KEY`,即可开启和使用 Clerk。
26
+
27
+ <Callout type={'info'}>
28
+ 详细的 Clerk 配置请参阅 [Clerk 配置指南](/zh/docs/self-hosting/advanced/auth/clerk)。
29
+ </Callout>
30
+
31
+ ## Next Auth
32
+
33
+ 在使用 NextAuth 之前,请先在 LobeChat 的环境变量中设置以下变量:
34
+
35
+ | 环境变量 | 类型 | 描述 |
36
+ | -------------------------------- | -- | ------------------------------------------------------------------------------------------------------------ |
37
+ | `NEXT_PUBLIC_ENABLE_NEXT_AUTH` | 必选 | 用于启用 NextAuth 服务,设置为 `1` 以启用,更改此项需要重新编译应用。使用 `lobehub/lobe-chat-database` 镜像部署的用户已经默认添加了该项配置。 |
38
+ | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令: `openssl rand -base64 32`,或者访问 `https://generate-secret.vercel.app/32` 生成秘钥。 |
39
+ | `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
40
+ | `NEXT_AUTH_SSO_PROVIDERS` | 可选 | 该环境变量用于同时启用多个身份验证源,以逗号 `,` 分割,例如 `auth0,microsoft-entra-id,authentik`。 |
41
+ | `NEXT_AUTH_SSO_SESSION_STRATEGY` | 可选 | Auth.js 的会话策略。选项为 `jwt` 或 `database`。默认值为 `jwt`。 |
42
+
43
+ 目前支持的身份验证服务有:
44
+
45
+ <Cards>
46
+ <Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/auth0'} title={'Auth0'} />
47
+
48
+ <Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id'} title={'Microsoft Entra ID'} />
49
+
50
+ <Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/authentik'} title={'Authentik'} />
51
+
52
+ <Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/github'} title={'Github'} />
53
+
54
+ <Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/zitadel'} title={'ZITADEL'} />
55
+
56
+ <Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust'} title={'Cloudflare Zero Trust'} />
57
+
58
+ <Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/authelia'} title={'Authelia'} />
59
+
60
+ <Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/logto'} title={'Logto'} />
61
+
62
+ <Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/keycloak'} title={'Keycloak'} />
63
+
64
+ <Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/okta'} title={'Okta'} />
65
+ </Cards>
66
+
67
+ 点击即可查看对应平台的配置文档。
68
+
69
+ ## 进阶配置
70
+
71
+ 同时启用多个身份验证源请设置 `NEXT_AUTH_SSO_PROVIDERS` 环境变量,以逗号 `,` 分割,例如 `auth0,microsoft-entra-id,authentik`。
72
+
73
+ 顺序为 SSO 提供商的显示顺序。
74
+
75
+ | SSO 提供商 | 值 | 额外功能 |
76
+ | --------------------- | ----------------------- | --------- |
77
+ | Auth0 | `auth0` | |
78
+ | Authenlia | `authenlia` | |
79
+ | Authentik | `authentik` | |
80
+ | Casdoor | `casdoor` | `Webhook` |
81
+ | Cloudflare Zero Trust | `cloudflare-zero-trust` | |
82
+ | Github | `github` | |
83
+ | Logto | `logto` | `Webhook` |
84
+ | Microsoft Entra ID | `microsoft-entra-id` | |
85
+ | ZITADEL | `zitadel` | |
86
+ | Keycloak | `keycloak` | |
87
+ | Okta | `okta` | |
88
+
89
+ ## 额外功能
90
+
91
+ ### Webhook 支持
92
+
93
+ 允许 LobeChat 在身份提供商中用户信息更新时接收通知。支持的提供商包括 Casdoor 和 Logto。请参考具体提供商文档进行配置。
94
+
95
+ ### 数据库会话
96
+
97
+ 允许会话存储在数据库中,详情请参阅 [Auth.js 会话文档](https://authjs.dev/concepts/session-strategies#database-session)。
98
+
99
+ ## 其他 SSO 提供商
100
+
101
+ 请参考 [NextAuth.js](https://next-auth.js.org/providers) 文档,欢迎提交 Pull Request。
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  title: Configure Auth0 Identity Verification Service for LobeChat
3
3
  description: >-
4
- Learn how to configure Auth0 Identity Verification Service for LobeChat for your organization, including creating applications, adding users, and configuring environment variables.
5
-
4
+ Learn how to configure Auth0 Identity Verification Service for LobeChat for
5
+ your organization, including creating applications, adding users, and
6
+ configuring environment variables.
6
7
  tags:
7
8
  - Auth0
8
9
  - Identity Verification
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  title: Configuring Authelia Authentication Service for LobeChat
3
3
  description: >-
4
- Learn how to configure Authelia authentication service in LobeChat, including creating a provider, configuring environment variables, and deploying LobeChat. Detailed steps and necessary environment variable settings.
5
-
4
+ Learn how to configure Authelia authentication service in LobeChat, including
5
+ creating a provider, configuring environment variables, and deploying
6
+ LobeChat. Detailed steps and necessary environment variable settings.
6
7
  tags:
7
8
  - Authelia Configuration
8
9
  - Single Sign-On (SSO)
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  title: Configuring Authentik Authentication Service for LobeChat
3
3
  description: >-
4
- Learn how to configure Authentik for Single Sign-On (SSO) for LobeChat, including creating an application provider, setting environment variables, and deployment instructions.
5
-
4
+ Learn how to configure Authentik for Single Sign-On (SSO) for LobeChat,
5
+ including creating an application provider, setting environment variables, and
6
+ deployment instructions.
6
7
  tags:
7
8
  - Authentik Configuration
8
9
  - Single Sign-On (SSO)
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  title: Configuring Casdoor Authentication Service in LobeChat
3
3
  description: >-
4
- Learn how to configure the Casdoor authentication service in LobeChat, including deployment, creation, permission settings, and environment variables.
5
-
4
+ Learn how to configure the Casdoor authentication service in LobeChat,
5
+ including deployment, creation, permission settings, and environment
6
+ variables.
6
7
  tags:
7
8
  - Casdoor Authentication
8
9
  - Environment Variable Configuration
@@ -87,6 +88,8 @@ If you are deploying using a public network, the following assumptions apply:
87
88
  box-shadow: none;
88
89
  }
89
90
  }
91
+
92
+
90
93
  </style>
91
94
  ```
92
95
 
@@ -85,6 +85,8 @@ tags:
85
85
  box-shadow: none;
86
86
  }
87
87
  }
88
+
89
+
88
90
  </style>
89
91
  ```
90
92
 
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  title: Configuring Cloudflare Zero Trust Authentication Service for LobeChat
3
3
  description: >-
4
- Learn how to configure Cloudflare Zero Trust for Single Sign-On (SSO) for LobeChat, including creating an application provider, setting environment variables, and deployment instructions.
5
-
4
+ Learn how to configure Cloudflare Zero Trust for Single Sign-On (SSO) for
5
+ LobeChat, including creating an application provider, setting environment
6
+ variables, and deployment instructions.
6
7
  tags:
7
8
  - Cloudflare Zero Trust
8
9
  - Single Sign-On (SSO)
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  title: 在 LobeChat 中配置 Cloudflare Zero Trust 身份验证服务
3
3
  description: >-
4
- 学习如何在 LobeChat 中配置 Cloudflare Zero Trust 身份验证服务,包括创建提供程序、配置环境变量和部署 LobeChat。详细步骤和必要环境变量设置。
5
-
4
+ 学习如何在 LobeChat 中配置 Cloudflare Zero Trust 身份验证服务,包括创建提供程序、配置环境变量和部署
5
+ LobeChat。详细步骤和必要环境变量设置。
6
6
  tags:
7
7
  - Cloudflare Zero Trust
8
8
  - 身份验证
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  title: Configuring Github Authentication Service for LobeChat
3
3
  description: >-
4
- Learn how to configure Github authentication service for LobeChat, including creating a Github provider, setting up environment variables, and deploying LobeChat.
5
-
4
+ Learn how to configure Github authentication service for LobeChat, including
5
+ creating a Github provider, setting up environment variables, and deploying
6
+ LobeChat.
6
7
  tags:
7
8
  - Github authentication
8
9
  - LobeChat
@@ -1,19 +1,17 @@
1
1
  ---
2
-
3
2
  title: Configuration of Google SSO Authentication Service for LobeChat
4
3
  description: >-
5
- Learn how to configure Google SSO Authentication Service for LobeChat,
6
- create OAuth applications, add users, and set up environment variables for seamless integration.
4
+ Learn how to configure Google SSO Authentication Service for LobeChat, create
5
+ OAuth applications, add users, and set up environment variables for seamless
6
+ integration.
7
7
  tags:
8
-
9
- * Google SSO
10
- * Authentication Service
11
- * Google Cloud
12
- * OAuth
13
- * SSO
14
- * Environment Variables
15
- * LobeChat
16
-
8
+ - Google SSO
9
+ - Authentication Service
10
+ - Google Cloud
11
+ - OAuth
12
+ - SSO
13
+ - Environment Variables
14
+ - LobeChat
17
15
  ---
18
16
 
19
17
  # Configuration of Google SSO Authentication Service
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  title: Configuring Keycloak Authentication Service in LobeChat
3
3
  description: >-
4
- Learn how to configure the Keycloak authentication service in LobeChat, including deployment, creation, permission settings, and environment variables.
5
-
4
+ Learn how to configure the Keycloak authentication service in LobeChat,
5
+ including deployment, creation, permission settings, and environment
6
+ variables.
6
7
  tags:
7
8
  - Keycloak Authentication
8
9
  - Environment Variable Configuration
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  title: Configuring Logto Authentication Service in LobeChat
3
3
  description: >-
4
- Learn how to configure Logto authentication service in LobeChat, including deployment, creation, setting permissions, and environment variables.
5
-
4
+ Learn how to configure Logto authentication service in LobeChat, including
5
+ deployment, creation, setting permissions, and environment variables.
6
6
  tags:
7
7
  - Logto Authentication
8
8
  - Environment Variable Configuration
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  title: Configuration of Microsoft Entra ID Authentication Service for LobeChat
3
3
  description: >-
4
- Learn how to configure Microsoft Entra ID Authentication Service for LobeChat, create applications, add users, and set up environment variables for seamless integration.
5
-
4
+ Learn how to configure Microsoft Entra ID Authentication Service for LobeChat,
5
+ create applications, add users, and set up environment variables for seamless
6
+ integration.
6
7
  tags:
7
8
  - Microsoft Entra ID
8
9
  - Authentication Service
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  title: Configure Okta Identity Verification Service for LobeChat
3
3
  description: >-
4
- Learn how to configure Okta Identity Verification Service for LobeChat for your organization, including creating applications, adding users, and configuring environment variables.
5
-
4
+ Learn how to configure Okta Identity Verification Service for LobeChat for
5
+ your organization, including creating applications, adding users, and
6
+ configuring environment variables.
6
7
  tags:
7
8
  - Okta
8
9
  - Identity Verification
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  title: 在 LobeChat 中配置 Okta 身份验证服务 - 详细步骤和环境变量设置
3
- description: >-
4
- 学习如何在 LobeChat 中为您的组织配置 Okta 身份验证服务,包括创建应用程序、添加用户和配置环境变量等。
5
-
3
+ description: 学习如何在 LobeChat 中为您的组织配置 Okta 身份验证服务,包括创建应用程序、添加用户和配置环境变量等。
6
4
  tags:
7
5
  - Okta
8
6
  - 身份验证
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  title: Configure Wechat Authentication Service in LobeChat
3
3
  description: >-
4
- Learn how to configure Wechat authentication service in LobeChat, including creating a new Wechat App, setting permissions, and environment variables.
5
-
4
+ Learn how to configure Wechat authentication service in LobeChat, including
5
+ creating a new Wechat App, setting permissions, and environment variables.
6
6
  tags:
7
7
  - Wechat Authentication
8
8
  - Wechat App
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  title: Configure ZITADEL Authentication Service for LobeChat
3
3
  description: >-
4
- Learn how to configure ZITADEL Authentication Service for LobeChat deployment, including creating ZITADEL applications, setting up environment variables, and enabling single sign-on (SSO).
5
-
4
+ Learn how to configure ZITADEL Authentication Service for LobeChat deployment,
5
+ including creating ZITADEL applications, setting up environment variables, and
6
+ enabling single sign-on (SSO).
6
7
  tags:
7
8
  - ZITADEL Authentication
8
9
  - LobeChat Deployment