@lobehub/lobehub 2.0.0-next.332 → 2.0.0-next.334
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/CHANGELOG.md +60 -0
- package/apps/desktop/src/main/const/dir.ts +3 -0
- package/apps/desktop/src/main/controllers/SystemCtr.ts +19 -0
- package/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts +1 -0
- package/apps/desktop/src/main/menus/impls/macOS.test.ts +1 -0
- package/changelog/v1.json +21 -0
- package/docs/changelog/2023-09-09-plugin-system.mdx +3 -2
- package/docs/changelog/2023-11-14-gpt4-vision.mdx +6 -4
- package/docs/changelog/2023-11-19-tts-stt.mdx +3 -2
- package/docs/changelog/2023-12-22-dalle-3.mdx +5 -2
- package/docs/changelog/2023-12-22-dalle-3.zh-CN.mdx +2 -2
- package/docs/changelog/2024-02-08-sso-oauth.mdx +2 -2
- package/docs/changelog/2024-06-19-lobe-chat-v1.mdx +3 -2
- package/docs/changelog/2024-06-19-lobe-chat-v1.zh-CN.mdx +2 -2
- package/docs/changelog/2024-07-19-gpt-4o-mini.mdx +3 -2
- package/docs/changelog/2024-07-19-gpt-4o-mini.zh-CN.mdx +2 -2
- package/docs/changelog/2024-08-02-lobe-chat-database-docker.mdx +3 -2
- package/docs/changelog/2024-08-21-file-upload-and-knowledge-base.mdx +5 -4
- package/docs/changelog/2024-09-13-openai-o1-models.mdx +2 -2
- package/docs/changelog/2024-09-20-artifacts.mdx +3 -2
- package/docs/changelog/2024-09-20-artifacts.zh-CN.mdx +2 -2
- package/docs/changelog/2024-10-27-pin-assistant.mdx +3 -2
- package/docs/changelog/2024-11-06-share-text-json.mdx +4 -2
- package/docs/changelog/2024-11-06-share-text-json.zh-CN.mdx +2 -2
- package/docs/changelog/2024-11-25-november-providers.mdx +2 -2
- package/docs/changelog/2024-11-27-forkable-chat.mdx +2 -2
- package/docs/changelog/2025-01-03-user-profile.mdx +2 -2
- package/docs/changelog/2025-01-22-new-ai-provider.mdx +2 -2
- package/docs/changelog/2025-02-02-deepseek-r1.mdx +4 -4
- package/docs/development/basic/add-new-authentication-providers.mdx +4 -0
- package/docs/development/basic/add-new-authentication-providers.zh-CN.mdx +4 -0
- package/docs/development/basic/add-new-image-model.mdx +4 -0
- package/docs/development/basic/add-new-image-model.zh-CN.mdx +4 -0
- package/docs/development/basic/architecture.mdx +4 -0
- package/docs/development/basic/architecture.zh-CN.mdx +4 -0
- package/docs/development/basic/chat-api.mdx +4 -0
- package/docs/development/basic/chat-api.zh-CN.mdx +4 -0
- package/docs/development/basic/comfyui-development.mdx +3 -1
- package/docs/development/basic/contributing-guidelines.mdx +4 -0
- package/docs/development/basic/contributing-guidelines.zh-CN.mdx +4 -0
- package/docs/development/basic/feature-development-frontend.mdx +11 -3
- package/docs/development/basic/feature-development-frontend.zh-CN.mdx +11 -3
- package/docs/development/basic/feature-development.mdx +14 -5
- package/docs/development/basic/feature-development.zh-CN.mdx +14 -5
- package/docs/development/basic/folder-structure.mdx +7 -0
- package/docs/development/basic/folder-structure.zh-CN.mdx +7 -0
- package/docs/development/basic/resources.mdx +4 -0
- package/docs/development/basic/resources.zh-CN.mdx +4 -0
- package/docs/development/basic/setup-development.mdx +4 -0
- package/docs/development/basic/setup-development.zh-CN.mdx +4 -0
- package/docs/development/basic/test.mdx +4 -0
- package/docs/development/basic/test.zh-CN.mdx +4 -0
- package/docs/development/basic/work-with-server-side-database.mdx +5 -5
- package/docs/development/basic/work-with-server-side-database.zh-CN.mdx +5 -5
- package/docs/development/internationalization/add-new-locale.mdx +4 -0
- package/docs/development/internationalization/add-new-locale.zh-CN.mdx +4 -0
- package/docs/development/internationalization/internationalization-implementation.mdx +4 -0
- package/docs/development/internationalization/internationalization-implementation.zh-CN.mdx +4 -0
- package/docs/development/others/lighthouse.mdx +4 -0
- package/docs/development/others/lighthouse.zh-CN.mdx +4 -0
- package/docs/development/start.mdx +4 -0
- package/docs/development/start.zh-CN.mdx +4 -0
- package/docs/development/state-management/state-management-intro.mdx +4 -2
- package/docs/development/state-management/state-management-intro.zh-CN.mdx +4 -2
- package/docs/development/state-management/state-management-selectors.mdx +6 -1
- package/docs/development/state-management/state-management-selectors.zh-CN.mdx +6 -1
- package/docs/development/tests/integration-testing.zh-CN.mdx +4 -0
- package/docs/self-hosting/advanced/analytics.mdx +2 -2
- package/docs/self-hosting/advanced/auth/better-auth/apple.mdx +132 -0
- package/docs/self-hosting/advanced/auth/better-auth/apple.zh-CN.mdx +127 -0
- package/docs/self-hosting/advanced/auth/better-auth/auth0.mdx +111 -0
- package/docs/self-hosting/advanced/auth/better-auth/auth0.zh-CN.mdx +107 -0
- package/docs/self-hosting/advanced/auth/better-auth/authelia.mdx +66 -0
- package/docs/self-hosting/advanced/auth/better-auth/authelia.zh-CN.mdx +62 -0
- package/docs/self-hosting/advanced/auth/better-auth/authentik.mdx +67 -0
- package/docs/self-hosting/advanced/auth/better-auth/authentik.zh-CN.mdx +63 -0
- package/docs/self-hosting/advanced/auth/better-auth/casdoor.mdx +62 -0
- package/docs/self-hosting/advanced/auth/better-auth/casdoor.zh-CN.mdx +58 -0
- package/docs/self-hosting/advanced/auth/better-auth/cloudflare-zero-trust.mdx +59 -0
- package/docs/self-hosting/advanced/auth/better-auth/cloudflare-zero-trust.zh-CN.mdx +55 -0
- package/docs/self-hosting/advanced/auth/better-auth/cognito.mdx +88 -0
- package/docs/self-hosting/advanced/auth/better-auth/cognito.zh-CN.mdx +85 -0
- package/docs/self-hosting/advanced/auth/better-auth/feishu.mdx +73 -0
- package/docs/self-hosting/advanced/auth/better-auth/feishu.zh-CN.mdx +69 -0
- package/docs/self-hosting/advanced/auth/better-auth/generic-oidc.mdx +86 -0
- package/docs/self-hosting/advanced/auth/better-auth/generic-oidc.zh-CN.mdx +83 -0
- package/docs/self-hosting/advanced/auth/better-auth/github.mdx +93 -0
- package/docs/self-hosting/advanced/auth/better-auth/github.zh-CN.mdx +90 -0
- package/docs/self-hosting/advanced/auth/better-auth/google.mdx +80 -0
- package/docs/self-hosting/advanced/auth/better-auth/google.zh-CN.mdx +77 -0
- package/docs/self-hosting/advanced/auth/better-auth/keycloak.mdx +77 -0
- package/docs/self-hosting/advanced/auth/better-auth/keycloak.zh-CN.mdx +74 -0
- package/docs/self-hosting/advanced/auth/better-auth/logto.mdx +64 -0
- package/docs/self-hosting/advanced/auth/better-auth/logto.zh-CN.mdx +60 -0
- package/docs/self-hosting/advanced/auth/better-auth/microsoft.mdx +113 -0
- package/docs/self-hosting/advanced/auth/better-auth/microsoft.zh-CN.mdx +109 -0
- package/docs/self-hosting/advanced/auth/better-auth/okta.mdx +67 -0
- package/docs/self-hosting/advanced/auth/better-auth/okta.zh-CN.mdx +63 -0
- package/docs/self-hosting/advanced/auth/better-auth/wechat.mdx +77 -0
- package/docs/self-hosting/advanced/auth/better-auth/wechat.zh-CN.mdx +72 -0
- package/docs/self-hosting/advanced/auth/better-auth/zitadel.mdx +73 -0
- package/docs/self-hosting/advanced/auth/better-auth/zitadel.zh-CN.mdx +69 -0
- package/docs/self-hosting/advanced/auth/clerk.mdx +2 -2
- package/docs/self-hosting/advanced/auth/legacy.mdx +106 -0
- package/docs/self-hosting/advanced/auth/legacy.zh-CN.mdx +101 -0
- package/docs/self-hosting/advanced/auth/next-auth/auth0.mdx +3 -2
- package/docs/self-hosting/advanced/auth/next-auth/authelia.mdx +3 -2
- package/docs/self-hosting/advanced/auth/next-auth/authentik.mdx +3 -2
- package/docs/self-hosting/advanced/auth/next-auth/casdoor.mdx +5 -2
- package/docs/self-hosting/advanced/auth/next-auth/casdoor.zh-CN.mdx +2 -0
- package/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.mdx +3 -2
- package/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.zh-CN.mdx +2 -2
- package/docs/self-hosting/advanced/auth/next-auth/github.mdx +3 -2
- package/docs/self-hosting/advanced/auth/next-auth/google.mdx +10 -12
- package/docs/self-hosting/advanced/auth/next-auth/keycloak.mdx +3 -2
- package/docs/self-hosting/advanced/auth/next-auth/logto.mdx +2 -2
- package/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id.mdx +3 -2
- package/docs/self-hosting/advanced/auth/next-auth/okta.mdx +3 -2
- package/docs/self-hosting/advanced/auth/next-auth/okta.zh-CN.mdx +1 -3
- package/docs/self-hosting/advanced/auth/next-auth/wechat.mdx +2 -2
- package/docs/self-hosting/advanced/auth/next-auth/zitadel.mdx +3 -2
- package/docs/self-hosting/advanced/auth.mdx +86 -139
- package/docs/self-hosting/advanced/auth.zh-CN.mdx +84 -135
- package/docs/self-hosting/advanced/desktop.mdx +9 -3
- package/docs/self-hosting/advanced/desktop.zh-CN.mdx +9 -3
- package/docs/self-hosting/advanced/feature-flags.mdx +3 -2
- package/docs/self-hosting/advanced/knowledge-base.mdx +2 -2
- package/docs/self-hosting/advanced/model-list.mdx +2 -2
- package/docs/self-hosting/advanced/observability/grafana.mdx +4 -2
- package/docs/self-hosting/advanced/observability/grafana.zh-CN.mdx +2 -1
- package/docs/self-hosting/advanced/observability/langfuse.mdx +3 -2
- package/docs/self-hosting/advanced/online-search.mdx +4 -6
- package/docs/self-hosting/advanced/s3/tencent-cloud.mdx +2 -2
- package/docs/self-hosting/advanced/settings-url-share.mdx +3 -2
- package/docs/self-hosting/advanced/upstream-sync.mdx +3 -4
- package/docs/self-hosting/advanced/upstream-sync.zh-CN.mdx +0 -2
- package/docs/self-hosting/environment-variables/analytics.mdx +3 -2
- package/docs/self-hosting/environment-variables/auth.mdx +5 -12
- package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +2 -9
- package/docs/self-hosting/environment-variables/basic.mdx +3 -10
- package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +0 -7
- package/docs/self-hosting/environment-variables/model-provider.mdx +3 -4
- package/docs/self-hosting/environment-variables/s3.mdx +2 -2
- package/docs/self-hosting/environment-variables.mdx +2 -3
- package/docs/self-hosting/examples/azure-openai.mdx +2 -3
- package/docs/self-hosting/examples/azure-openai.zh-CN.mdx +0 -1
- package/docs/self-hosting/examples/ollama.mdx +3 -2
- package/docs/self-hosting/faq/no-v1-suffix.mdx +4 -4
- package/docs/self-hosting/faq/proxy-with-unable-to-verify-leaf-signature.mdx +3 -2
- package/docs/self-hosting/faq/vercel-ai-image-timeout.mdx +2 -2
- package/docs/self-hosting/migration/v2/breaking-changes.mdx +73 -0
- package/docs/self-hosting/migration/v2/breaking-changes.zh-CN.mdx +71 -0
- package/docs/self-hosting/platform/alibaba-cloud.mdx +2 -7
- package/docs/self-hosting/platform/alibaba-cloud.zh-CN.mdx +1 -6
- package/docs/self-hosting/platform/btpanel.mdx +4 -2
- package/docs/self-hosting/platform/btpanel.zh-CN.mdx +2 -2
- package/docs/self-hosting/platform/docker-compose.mdx +3 -3
- package/docs/self-hosting/platform/docker-compose.zh-CN.mdx +0 -1
- package/docs/self-hosting/platform/docker.mdx +2 -11
- package/docs/self-hosting/platform/docker.zh-CN.mdx +0 -8
- package/docs/self-hosting/platform/netlify.mdx +5 -17
- package/docs/self-hosting/platform/netlify.zh-CN.mdx +3 -17
- package/docs/self-hosting/platform/railway.mdx +3 -7
- package/docs/self-hosting/platform/railway.zh-CN.mdx +1 -7
- package/docs/self-hosting/platform/repocloud.mdx +3 -7
- package/docs/self-hosting/platform/repocloud.zh-CN.mdx +1 -6
- package/docs/self-hosting/platform/sealos.mdx +2 -7
- package/docs/self-hosting/platform/sealos.zh-CN.mdx +1 -6
- package/docs/self-hosting/platform/tencentcloud-lighthouse.mdx +2 -7
- package/docs/self-hosting/platform/tencentcloud-lighthouse.zh-CN.mdx +1 -6
- package/docs/self-hosting/platform/vercel.mdx +4 -9
- package/docs/self-hosting/platform/vercel.zh-CN.mdx +3 -8
- package/docs/self-hosting/platform/zeabur.mdx +2 -11
- package/docs/self-hosting/platform/zeabur.zh-CN.mdx +1 -10
- package/docs/self-hosting/server-database/docker-compose.mdx +11 -19
- package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +12 -21
- package/docs/self-hosting/server-database/docker.mdx +9 -24
- package/docs/self-hosting/server-database/docker.zh-CN.mdx +7 -24
- package/docs/self-hosting/server-database/dokploy.mdx +27 -25
- package/docs/self-hosting/server-database/dokploy.zh-CN.mdx +23 -21
- package/docs/self-hosting/server-database/netlify.mdx +2 -2
- package/docs/self-hosting/server-database/netlify.zh-CN.mdx +2 -2
- package/docs/self-hosting/server-database/railway.mdx +2 -2
- package/docs/self-hosting/server-database/repocloud.mdx +2 -2
- package/docs/self-hosting/server-database/sealos.mdx +2 -2
- package/docs/self-hosting/server-database/vercel.mdx +19 -72
- package/docs/self-hosting/server-database/vercel.zh-CN.mdx +17 -68
- package/docs/self-hosting/server-database/zeabur.mdx +2 -2
- package/docs/self-hosting/server-database.mdx +1 -19
- package/docs/self-hosting/server-database.zh-CN.mdx +0 -17
- package/docs/self-hosting/start.mdx +2 -2
- package/docs/self-hosting/start.zh-CN.mdx +2 -2
- package/locales/ar/common.json +1 -0
- package/locales/bg-BG/common.json +1 -0
- package/locales/de-DE/common.json +1 -0
- package/locales/en-US/common.json +1 -0
- package/locales/en-US/desktop-onboarding.json +1 -0
- package/locales/es-ES/common.json +1 -0
- package/locales/fa-IR/common.json +1 -0
- package/locales/fr-FR/common.json +1 -0
- package/locales/it-IT/common.json +1 -0
- package/locales/ja-JP/common.json +1 -0
- package/locales/ko-KR/common.json +1 -0
- package/locales/nl-NL/common.json +1 -0
- package/locales/pl-PL/common.json +1 -0
- package/locales/pt-BR/common.json +1 -0
- package/locales/ru-RU/common.json +1 -0
- package/locales/tr-TR/common.json +1 -0
- package/locales/vi-VN/common.json +1 -0
- package/locales/zh-CN/common.json +1 -0
- package/locales/zh-CN/desktop-onboarding.json +1 -0
- package/locales/zh-TW/common.json +1 -0
- package/package.json +2 -2
- package/packages/builtin-tool-cloud-sandbox/src/systemRole.ts +62 -2
- package/packages/const/src/url.ts +6 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/index.ts +2 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/multi-tasks-with-summary.json +234 -0
- package/packages/conversation-flow/src/__tests__/parse.test.ts +25 -0
- package/packages/conversation-flow/src/transformation/ContextTreeBuilder.ts +15 -0
- package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +20 -0
- package/packages/types/src/serverConfig.ts +0 -1
- package/src/app/[variants]/(desktop)/desktop-onboarding/features/LoginStep.tsx +39 -1
- package/src/app/[variants]/(main)/settings/common/features/Common/Common.tsx +34 -14
- package/src/app/[variants]/(mobile)/me/(home)/features/useCategory.tsx +16 -9
- package/src/app/[variants]/layout.tsx +0 -4
- package/src/envs/app.ts +0 -13
- package/src/features/User/UserPanel/useMenu.tsx +18 -9
- package/src/hooks/usePlatform.test.ts +5 -0
- package/src/hooks/usePlatform.ts +1 -0
- package/src/locales/default/common.ts +1 -0
- package/src/locales/default/desktop-onboarding.ts +1 -0
- package/src/server/globalConfig/index.ts +1 -2
- package/src/services/electron/system.ts +4 -0
- package/src/store/serverConfig/selectors.ts +0 -1
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: LobeChat Authentication Service Configuration
|
|
3
3
|
description: >-
|
|
4
|
-
Learn how to configure
|
|
5
|
-
|
|
4
|
+
Learn how to configure Better Auth for centralized user authorization
|
|
5
|
+
management. Supported SSO providers include Google, GitHub, Microsoft, and
|
|
6
|
+
more.
|
|
6
7
|
tags:
|
|
7
8
|
- Authentication Service
|
|
8
9
|
- Better Auth
|
|
9
|
-
- Next Auth
|
|
10
10
|
- SSO
|
|
11
|
-
- Clerk
|
|
12
11
|
---
|
|
13
12
|
|
|
14
13
|
# Authentication Service
|
|
15
14
|
|
|
16
|
-
LobeChat
|
|
17
|
-
|
|
18
|
-
## Clerk
|
|
19
|
-
|
|
20
|
-
Clerk is a comprehensive identity verification solution that has recently gained popularity. It provides a simple yet powerful API and services to handle user authentication and session management. Clerk's design philosophy is to offer a concise and modern authentication solution that enables developers to easily integrate and use it.
|
|
21
|
-
|
|
22
|
-
LobeChat has deeply integrated with Clerk to provide users with a more secure and convenient login and registration experience. It also relieves developers from the burden of managing authentication logic. Clerk's concise and modern design philosophy aligns perfectly with LobeChat's goals, making user management on the entire platform more efficient and reliable.
|
|
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.
|
|
15
|
+
LobeChat uses [Better Auth](https://www.better-auth.com) as its authentication solution, providing comprehensive, secure, and flexible identity verification for self-hosted deployments.
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
<Callout type={'info'}>
|
|
18
|
+
Looking for legacy authentication methods? See [Legacy Authentication](/docs/self-hosting/advanced/auth/legacy) for NextAuth and Clerk documentation.
|
|
19
|
+
</Callout>
|
|
29
20
|
|
|
30
|
-
|
|
21
|
+
## Key Features
|
|
31
22
|
|
|
32
23
|
- **Email/Password Authentication**: Built-in support for traditional email and password login with secure password hashing
|
|
33
24
|
- **Email Verification**: Optional email verification flow with customizable email templates
|
|
@@ -35,160 +26,116 @@ By setting the environment variables `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CL
|
|
|
35
26
|
- **OAuth/SSO Support**: Integration with popular identity providers including Google, GitHub, Microsoft, AWS Cognito, and more
|
|
36
27
|
- **Generic OIDC/OAuth**: Support for any OpenID Connect or OAuth 2.0 compliant provider
|
|
37
28
|
|
|
38
|
-
|
|
29
|
+
## Getting Started
|
|
39
30
|
|
|
40
31
|
To enable Better Auth in LobeChat, set the following environment variables:
|
|
41
32
|
|
|
42
|
-
| Environment Variable
|
|
43
|
-
|
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
| Authelia | `authelia` | `AUTH_AUTHELIA_ID`, `AUTH_AUTHELIA_SECRET`, `AUTH_AUTHELIA_ISSUER` |
|
|
71
|
-
| Authentik | `authentik` | `AUTH_AUTHENTIK_ID`, `AUTH_AUTHENTIK_SECRET`, `AUTH_AUTHENTIK_ISSUER` |
|
|
72
|
-
| Casdoor | `casdoor` | `AUTH_CASDOOR_ID`, `AUTH_CASDOOR_SECRET`, `AUTH_CASDOOR_ISSUER` |
|
|
73
|
-
| Cloudflare Zero Trust | `cloudflare-zero-trust` | `AUTH_CLOUDFLARE_ZERO_TRUST_ID`, `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET`, `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` |
|
|
74
|
-
| Keycloak | `keycloak` | `AUTH_KEYCLOAK_ID`, `AUTH_KEYCLOAK_SECRET`, `AUTH_KEYCLOAK_ISSUER` |
|
|
75
|
-
| Logto | `logto` | `AUTH_LOGTO_ID`, `AUTH_LOGTO_SECRET`, `AUTH_LOGTO_ISSUER` |
|
|
76
|
-
| Okta | `okta` | `AUTH_OKTA_ID`, `AUTH_OKTA_SECRET`, `AUTH_OKTA_ISSUER` |
|
|
77
|
-
| ZITADEL | `zitadel` | `AUTH_ZITADEL_ID`, `AUTH_ZITADEL_SECRET`, `AUTH_ZITADEL_ISSUER` |
|
|
78
|
-
| Generic OIDC | `generic-oidc` | `AUTH_GENERIC_OIDC_ID`, `AUTH_GENERIC_OIDC_SECRET`, `AUTH_GENERIC_OIDC_ISSUER` |
|
|
79
|
-
| Feishu | `feishu` | `AUTH_FEISHU_APP_ID`, `AUTH_FEISHU_APP_SECRET` |
|
|
80
|
-
| WeChat | `wechat` | `AUTH_WECHAT_ID`, `AUTH_WECHAT_SECRET` |
|
|
81
|
-
|
|
82
|
-
### Callback URL Format
|
|
83
|
-
|
|
84
|
-
When configuring OAuth providers, use the following callback URL format:
|
|
85
|
-
|
|
86
|
-
- **Development**: `http://localhost:3210/api/auth/callback/{provider}`
|
|
87
|
-
- **Production**: `https://yourdomain.com/api/auth/callback/{provider}`
|
|
88
|
-
|
|
89
|
-
### Email Service Configuration
|
|
90
|
-
|
|
91
|
-
Used by email verification, password reset, and magic-link delivery. Choose a provider, then fill the matching variables:
|
|
33
|
+
| Environment Variable | Type | Description |
|
|
34
|
+
| -------------------- | -------- | ------------------------------------------------------------------------------ |
|
|
35
|
+
| `AUTH_SECRET` | Required | Key used to encrypt session tokens. Generate using: `openssl rand -base64 32` |
|
|
36
|
+
| `AUTH_SSO_PROVIDERS` | Optional | Comma-separated list of enabled SSO providers, e.g., `google,github,microsoft` |
|
|
37
|
+
|
|
38
|
+
## Supported SSO Providers
|
|
39
|
+
|
|
40
|
+
| Provider | Value | Environment Variables |
|
|
41
|
+
| --------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
42
|
+
| Google | `google` | `AUTH_GOOGLE_ID`, `AUTH_GOOGLE_SECRET` |
|
|
43
|
+
| GitHub | `github` | `AUTH_GITHUB_ID`, `AUTH_GITHUB_SECRET` |
|
|
44
|
+
| Microsoft | `microsoft` | `AUTH_MICROSOFT_ID`, `AUTH_MICROSOFT_SECRET` |
|
|
45
|
+
| Apple | `apple` | `AUTH_APPLE_CLIENT_ID`, `AUTH_APPLE_CLIENT_SECRET` |
|
|
46
|
+
| AWS Cognito | `cognito` | `AUTH_COGNITO_ID`, `AUTH_COGNITO_SECRET`, `AUTH_COGNITO_DOMAIN`, `AUTH_COGNITO_REGION`, `AUTH_COGNITO_USERPOOL_ID` |
|
|
47
|
+
| Auth0 | `auth0` | `AUTH_AUTH0_ID`, `AUTH_AUTH0_SECRET`, `AUTH_AUTH0_ISSUER` |
|
|
48
|
+
| Authelia | `authelia` | `AUTH_AUTHELIA_ID`, `AUTH_AUTHELIA_SECRET`, `AUTH_AUTHELIA_ISSUER` |
|
|
49
|
+
| Authentik | `authentik` | `AUTH_AUTHENTIK_ID`, `AUTH_AUTHENTIK_SECRET`, `AUTH_AUTHENTIK_ISSUER` |
|
|
50
|
+
| Casdoor | `casdoor` | `AUTH_CASDOOR_ID`, `AUTH_CASDOOR_SECRET`, `AUTH_CASDOOR_ISSUER` |
|
|
51
|
+
| Cloudflare Zero Trust | `cloudflare-zero-trust` | `AUTH_CLOUDFLARE_ZERO_TRUST_ID`, `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET`, `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` |
|
|
52
|
+
| Keycloak | `keycloak` | `AUTH_KEYCLOAK_ID`, `AUTH_KEYCLOAK_SECRET`, `AUTH_KEYCLOAK_ISSUER` |
|
|
53
|
+
| Logto | `logto` | `AUTH_LOGTO_ID`, `AUTH_LOGTO_SECRET`, `AUTH_LOGTO_ISSUER` |
|
|
54
|
+
| Okta | `okta` | `AUTH_OKTA_ID`, `AUTH_OKTA_SECRET`, `AUTH_OKTA_ISSUER` |
|
|
55
|
+
| ZITADEL | `zitadel` | `AUTH_ZITADEL_ID`, `AUTH_ZITADEL_SECRET`, `AUTH_ZITADEL_ISSUER` |
|
|
56
|
+
| Generic OIDC | `generic-oidc` | `AUTH_GENERIC_OIDC_ID`, `AUTH_GENERIC_OIDC_SECRET`, `AUTH_GENERIC_OIDC_ISSUER` |
|
|
57
|
+
| Feishu | `feishu` | `AUTH_FEISHU_APP_ID`, `AUTH_FEISHU_APP_SECRET` |
|
|
58
|
+
| WeChat | `wechat` | `AUTH_WECHAT_ID`, `AUTH_WECHAT_SECRET` |
|
|
59
|
+
|
|
60
|
+
Click on a provider below for detailed configuration guides:
|
|
92
61
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
| `NEXT_PUBLIC_AUTH_EMAIL_VERIFICATION` | Optional | Set to `1` to require email verification before users can sign in |
|
|
96
|
-
| `EMAIL_SERVICE_PROVIDER` | Optional | Email provider selector: `nodemailer` (default, SMTP) or `resend` |
|
|
97
|
-
| `SMTP_HOST` | Required | SMTP server hostname (e.g., `smtp.gmail.com`). Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
|
98
|
-
| `SMTP_PORT` | Required | SMTP server port (usually `587` for TLS, `465` for SSL). Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
|
99
|
-
| `SMTP_SECURE` | Optional | `true` for SSL (port 465), `false` for TLS (port 587). Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
|
100
|
-
| `SMTP_USER` | Required | SMTP auth username. Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
|
101
|
-
| `SMTP_PASS` | Required | SMTP auth password. Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
|
102
|
-
| `RESEND_API_KEY` | Required | Resend API key. Required when `EMAIL_SERVICE_PROVIDER=resend` |
|
|
103
|
-
| `RESEND_FROM` | Recommended | Default sender address (e.g., `noreply@your-verified-domain.com`). Must be a domain verified in Resend. Used when `EMAIL_SERVICE_PROVIDER=resend` |
|
|
62
|
+
<Cards>
|
|
63
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/github'} title={'GitHub'} />
|
|
104
64
|
|
|
105
|
-
|
|
65
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/google'} title={'Google'} />
|
|
106
66
|
|
|
107
|
-
|
|
67
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/microsoft'} title={'Microsoft'} />
|
|
108
68
|
|
|
109
|
-
|
|
110
|
-
| ------------------------------- | -------- | -------------------------------------------------- |
|
|
111
|
-
| `NEXT_PUBLIC_ENABLE_MAGIC_LINK` | Optional | Set to `1` to enable passwordless magic-link login |
|
|
69
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/apple'} title={'Apple'} />
|
|
112
70
|
|
|
113
|
-
<
|
|
114
|
-
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).
|
|
115
|
-
</Callout>
|
|
116
|
-
|
|
117
|
-
<Callout type={'tip'}>
|
|
118
|
-
Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#better-auth) for detailed information on all Better Auth variables.
|
|
119
|
-
</Callout>
|
|
71
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/cognito'} title={'AWS Cognito'} />
|
|
120
72
|
|
|
121
|
-
|
|
73
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/auth0'} title={'Auth0'} />
|
|
122
74
|
|
|
123
|
-
|
|
75
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/authelia'} title={'Authelia'} />
|
|
124
76
|
|
|
125
|
-
|
|
126
|
-
| -------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
127
|
-
| `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. |
|
|
128
|
-
| `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. |
|
|
129
|
-
| `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` |
|
|
130
|
-
| `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`. |
|
|
131
|
-
| `NEXT_AUTH_SSO_SESSION_STRATEGY` | Optional | The session strategy for Auth.js. Options are `jwt` or `database`. Default is `jwt`. |
|
|
77
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/authentik'} title={'Authentik'} />
|
|
132
78
|
|
|
133
|
-
|
|
79
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/casdoor'} title={'Casdoor'} />
|
|
134
80
|
|
|
135
|
-
<
|
|
136
|
-
<Card href={'/docs/self-hosting/advanced/auth/next-auth/auth0'} title={'Auth0'} />
|
|
81
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/cloudflare-zero-trust'} title={'Cloudflare Zero Trust'} />
|
|
137
82
|
|
|
138
|
-
<Card href={'/docs/self-hosting/advanced/auth/
|
|
83
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/keycloak'} title={'Keycloak'} />
|
|
139
84
|
|
|
140
|
-
<Card href={'/docs/self-hosting/advanced/auth/
|
|
85
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/logto'} title={'Logto'} />
|
|
141
86
|
|
|
142
|
-
<Card href={'/docs/self-hosting/advanced/auth/
|
|
87
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/okta'} title={'Okta'} />
|
|
143
88
|
|
|
144
|
-
<Card href={'/docs/self-hosting/advanced/auth/
|
|
89
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/zitadel'} title={'ZITADEL'} />
|
|
145
90
|
|
|
146
|
-
<Card href={'/docs/self-hosting/advanced/auth/
|
|
91
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/generic-oidc'} title={'Generic OIDC'} />
|
|
147
92
|
|
|
148
|
-
<Card href={'/docs/self-hosting/advanced/auth/
|
|
93
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/feishu'} title={'Feishu'} />
|
|
149
94
|
|
|
150
|
-
<Card href={'/docs/self-hosting/advanced/auth/
|
|
95
|
+
<Card href={'/docs/self-hosting/advanced/auth/better-auth/wechat'} title={'WeChat'} />
|
|
96
|
+
</Cards>
|
|
151
97
|
|
|
152
|
-
|
|
98
|
+
## Callback URL Format
|
|
153
99
|
|
|
154
|
-
|
|
100
|
+
When configuring OAuth providers, use the following callback URL format:
|
|
155
101
|
|
|
156
|
-
|
|
157
|
-
|
|
102
|
+
- **Development**: `http://localhost:3210/api/auth/callback/{provider}`
|
|
103
|
+
- **Production**: `https://yourdomain.com/api/auth/callback/{provider}`
|
|
158
104
|
|
|
159
|
-
|
|
105
|
+
## Email Service Configuration
|
|
160
106
|
|
|
161
|
-
|
|
107
|
+
Used by email verification, password reset, and magic-link delivery. Choose a provider, then fill the matching variables:
|
|
162
108
|
|
|
163
|
-
|
|
109
|
+
| Environment Variable | Type | Description |
|
|
110
|
+
| ------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
111
|
+
| `AUTH_EMAIL_VERIFICATION` | Optional | Set to `1` to require email verification before sign in (off by default) |
|
|
112
|
+
| `EMAIL_SERVICE_PROVIDER` | Optional | Email provider selector: `nodemailer` (default, SMTP) or `resend` |
|
|
113
|
+
| `SMTP_HOST` | Required | SMTP server hostname (e.g., `smtp.gmail.com`). Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
|
114
|
+
| `SMTP_PORT` | Required | SMTP server port (usually `587` for TLS, `465` for SSL). Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
|
115
|
+
| `SMTP_SECURE` | Optional | `true` for SSL (port 465), `false` for TLS (port 587). Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
|
116
|
+
| `SMTP_USER` | Required | SMTP auth username. Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
|
117
|
+
| `SMTP_PASS` | Required | SMTP auth password. Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
|
118
|
+
| `RESEND_API_KEY` | Required | Resend API key. Required when `EMAIL_SERVICE_PROVIDER=resend` |
|
|
119
|
+
| `RESEND_FROM` | Recommended | Default sender address (e.g., `noreply@your-verified-domain.com`). Must be a domain verified in Resend. Used when `EMAIL_SERVICE_PROVIDER=resend` |
|
|
164
120
|
|
|
165
|
-
|
|
121
|
+
## Magic Link (Passwordless) Login
|
|
166
122
|
|
|
167
|
-
|
|
168
|
-
| --------------------- | ----------------------- | ------------------- |
|
|
169
|
-
| Auth0 | `auth0` | |
|
|
170
|
-
| Authenlia | `authenlia` | |
|
|
171
|
-
| Authentik | `authentik` | |
|
|
172
|
-
| Casdoor | `casdoor` | `Webhook` |
|
|
173
|
-
| Cloudflare Zero Trust | `cloudflare-zero-trust` | |
|
|
174
|
-
| Github | `github` | |
|
|
175
|
-
| Logto | `logto` | `Webhook` |
|
|
176
|
-
| Microsoft Entra ID | `microsoft-entra-id` | |
|
|
177
|
-
| ZITADEL | `zitadel` | |
|
|
178
|
-
| Keycloak | `keycloak` | |
|
|
179
|
-
| Google | `google` | |
|
|
180
|
-
| Okta | `okta` | |
|
|
123
|
+
Enable magic-link login (depends on a working email provider above, off by default):
|
|
181
124
|
|
|
182
|
-
|
|
125
|
+
| Environment Variable | Type | Description |
|
|
126
|
+
| -------------------- | -------- | ------------------------------------------------------------------- |
|
|
127
|
+
| `ENABLE_MAGIC_LINK` | Optional | Set to `1` to enable passwordless magic-link login (off by default) |
|
|
183
128
|
|
|
184
|
-
|
|
129
|
+
<Callout type={'tip'}>
|
|
130
|
+
Go to [Environment Variables](/docs/self-hosting/environment-variables/auth#better-auth) for detailed information on all Better Auth variables.
|
|
131
|
+
</Callout>
|
|
185
132
|
|
|
186
|
-
|
|
133
|
+
## FAQ
|
|
187
134
|
|
|
188
|
-
###
|
|
135
|
+
### What SSO providers does Better Auth support?
|
|
189
136
|
|
|
190
|
-
|
|
137
|
+
Better Auth supports built-in providers (Google, GitHub, Microsoft, Apple, AWS Cognito) and Generic OIDC providers (Auth0, Authelia, Authentik, Casdoor, Cloudflare Zero Trust, Keycloak, Logto, Okta, ZITADEL, Generic OIDC, Feishu, WeChat).
|
|
191
138
|
|
|
192
|
-
|
|
139
|
+
### How do I enable multiple SSO providers?
|
|
193
140
|
|
|
194
|
-
|
|
141
|
+
Set the `AUTH_SSO_PROVIDERS` environment variable with a comma-separated list, e.g., `google,github,microsoft`. The order determines the display order on the login page.
|
|
@@ -1,31 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: LobeChat 身份验证服务配置
|
|
3
|
-
description:
|
|
3
|
+
description: 了解如何配置 Better Auth 以统一管理用户授权。支持的 SSO 提供商包括 Google、GitHub、Microsoft 等。
|
|
4
4
|
tags:
|
|
5
5
|
- 身份验证服务
|
|
6
6
|
- Better Auth
|
|
7
|
-
- LobeChat
|
|
8
7
|
- SSO
|
|
9
|
-
- Clerk
|
|
10
8
|
---
|
|
11
9
|
|
|
12
10
|
# 身份验证服务
|
|
13
11
|
|
|
14
|
-
LobeChat
|
|
12
|
+
LobeChat 使用 [Better Auth](https://www.better-auth.com) 作为身份验证解决方案,为自托管部署提供全面、安全、灵活的身份验证服务。
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
LobeChat 与 Clerk 做了深度集成,能够为用户提供一个更加安全、便捷的登录和注册体验,同时也为开发者减轻了管理身份验证逻辑的负担。Clerk 的简洁和现代的设计理念与 LobeChat 的目标非常契合,使得整个平台的用户管理更加高效和可靠。
|
|
21
|
-
|
|
22
|
-
在 LobeChat 的环境变量中设置 `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` 和 `CLERK_SECRET_KEY`,即可开启和使用 Clerk。
|
|
23
|
-
|
|
24
|
-
## Better Auth
|
|
25
|
-
|
|
26
|
-
[Better Auth](https://www.better-auth.com) 是一个现代化、框架无关的身份验证库,旨在提供全面、安全、灵活的身份验证解决方案。它支持多种认证方式,包括邮箱 / 密码登录、魔法链接登录以及多种 OAuth/SSO 提供商。
|
|
14
|
+
<Callout type={'info'}>
|
|
15
|
+
需要使用旧版身份验证方案?请参阅 [旧版身份验证](/zh/docs/self-hosting/advanced/auth/legacy) 了解 NextAuth 和 Clerk 的文档。
|
|
16
|
+
</Callout>
|
|
27
17
|
|
|
28
|
-
|
|
18
|
+
## 主要特性
|
|
29
19
|
|
|
30
20
|
- **邮箱 / 密码认证**:内置支持传统的邮箱和密码登录,采用安全的密码哈希算法
|
|
31
21
|
- **邮箱验证**:可选的邮箱验证流程,支持自定义邮件模板
|
|
@@ -33,157 +23,116 @@ LobeChat 与 Clerk 做了深度集成,能够为用户提供一个更加安全
|
|
|
33
23
|
- **OAuth/SSO 支持**:集成 Google、GitHub、Microsoft、AWS Cognito 等主流身份提供商
|
|
34
24
|
- **通用 OIDC/OAuth**:支持任何符合 OpenID Connect 或 OAuth 2.0 标准的提供商
|
|
35
25
|
|
|
36
|
-
|
|
26
|
+
## 快速开始
|
|
37
27
|
|
|
38
28
|
要在 LobeChat 中启用 Better Auth,请设置以下环境变量:
|
|
39
29
|
|
|
40
|
-
| 环境变量
|
|
41
|
-
|
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
| Authelia | `authelia` | `AUTH_AUTHELIA_ID`, `AUTH_AUTHELIA_SECRET`, `AUTH_AUTHELIA_ISSUER` |
|
|
69
|
-
| Authentik | `authentik` | `AUTH_AUTHENTIK_ID`, `AUTH_AUTHENTIK_SECRET`, `AUTH_AUTHENTIK_ISSUER` |
|
|
70
|
-
| Casdoor | `casdoor` | `AUTH_CASDOOR_ID`, `AUTH_CASDOOR_SECRET`, `AUTH_CASDOOR_ISSUER` |
|
|
71
|
-
| Cloudflare Zero Trust | `cloudflare-zero-trust` | `AUTH_CLOUDFLARE_ZERO_TRUST_ID`, `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET`, `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` |
|
|
72
|
-
| Keycloak | `keycloak` | `AUTH_KEYCLOAK_ID`, `AUTH_KEYCLOAK_SECRET`, `AUTH_KEYCLOAK_ISSUER` |
|
|
73
|
-
| Logto | `logto` | `AUTH_LOGTO_ID`, `AUTH_LOGTO_SECRET`, `AUTH_LOGTO_ISSUER` |
|
|
74
|
-
| Okta | `okta` | `AUTH_OKTA_ID`, `AUTH_OKTA_SECRET`, `AUTH_OKTA_ISSUER` |
|
|
75
|
-
| ZITADEL | `zitadel` | `AUTH_ZITADEL_ID`, `AUTH_ZITADEL_SECRET`, `AUTH_ZITADEL_ISSUER` |
|
|
76
|
-
| Generic OIDC | `generic-oidc` | `AUTH_GENERIC_OIDC_ID`, `AUTH_GENERIC_OIDC_SECRET`, `AUTH_GENERIC_OIDC_ISSUER` |
|
|
77
|
-
| 飞书 | `feishu` | `AUTH_FEISHU_APP_ID`, `AUTH_FEISHU_APP_SECRET` |
|
|
78
|
-
| 微信 | `wechat` | `AUTH_WECHAT_ID`, `AUTH_WECHAT_SECRET` |
|
|
79
|
-
|
|
80
|
-
### 回调 URL 格式
|
|
81
|
-
|
|
82
|
-
配置 OAuth 提供商时,请使用以下回调 URL 格式:
|
|
83
|
-
|
|
84
|
-
- **开发环境**:`http://localhost:3210/api/auth/callback/{provider}`
|
|
85
|
-
- **生产环境**:`https://yourdomain.com/api/auth/callback/{provider}`
|
|
86
|
-
|
|
87
|
-
### 邮件服务配置
|
|
30
|
+
| 环境变量 | 类型 | 描述 |
|
|
31
|
+
| -------------------- | -- | ------------------------------------------------ |
|
|
32
|
+
| `AUTH_SECRET` | 必选 | 用于加密会话令牌的密钥。使用以下命令生成:`openssl rand -base64 32` |
|
|
33
|
+
| `AUTH_SSO_PROVIDERS` | 可选 | 启用的 SSO 提供商列表,以逗号分隔,例如 `google,github,microsoft` |
|
|
34
|
+
|
|
35
|
+
## 支持的 SSO 提供商
|
|
36
|
+
|
|
37
|
+
| 提供商 | 值 | 环境变量 |
|
|
38
|
+
| --------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
39
|
+
| Google | `google` | `AUTH_GOOGLE_ID`, `AUTH_GOOGLE_SECRET` |
|
|
40
|
+
| GitHub | `github` | `AUTH_GITHUB_ID`, `AUTH_GITHUB_SECRET` |
|
|
41
|
+
| Microsoft | `microsoft` | `AUTH_MICROSOFT_ID`, `AUTH_MICROSOFT_SECRET` |
|
|
42
|
+
| Apple | `apple` | `AUTH_APPLE_CLIENT_ID`, `AUTH_APPLE_CLIENT_SECRET` |
|
|
43
|
+
| AWS Cognito | `cognito` | `AUTH_COGNITO_ID`, `AUTH_COGNITO_SECRET`, `AUTH_COGNITO_DOMAIN`, `AUTH_COGNITO_REGION`, `AUTH_COGNITO_USERPOOL_ID` |
|
|
44
|
+
| Auth0 | `auth0` | `AUTH_AUTH0_ID`, `AUTH_AUTH0_SECRET`, `AUTH_AUTH0_ISSUER` |
|
|
45
|
+
| Authelia | `authelia` | `AUTH_AUTHELIA_ID`, `AUTH_AUTHELIA_SECRET`, `AUTH_AUTHELIA_ISSUER` |
|
|
46
|
+
| Authentik | `authentik` | `AUTH_AUTHENTIK_ID`, `AUTH_AUTHENTIK_SECRET`, `AUTH_AUTHENTIK_ISSUER` |
|
|
47
|
+
| Casdoor | `casdoor` | `AUTH_CASDOOR_ID`, `AUTH_CASDOOR_SECRET`, `AUTH_CASDOOR_ISSUER` |
|
|
48
|
+
| Cloudflare Zero Trust | `cloudflare-zero-trust` | `AUTH_CLOUDFLARE_ZERO_TRUST_ID`, `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET`, `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` |
|
|
49
|
+
| Keycloak | `keycloak` | `AUTH_KEYCLOAK_ID`, `AUTH_KEYCLOAK_SECRET`, `AUTH_KEYCLOAK_ISSUER` |
|
|
50
|
+
| Logto | `logto` | `AUTH_LOGTO_ID`, `AUTH_LOGTO_SECRET`, `AUTH_LOGTO_ISSUER` |
|
|
51
|
+
| Okta | `okta` | `AUTH_OKTA_ID`, `AUTH_OKTA_SECRET`, `AUTH_OKTA_ISSUER` |
|
|
52
|
+
| ZITADEL | `zitadel` | `AUTH_ZITADEL_ID`, `AUTH_ZITADEL_SECRET`, `AUTH_ZITADEL_ISSUER` |
|
|
53
|
+
| Generic OIDC | `generic-oidc` | `AUTH_GENERIC_OIDC_ID`, `AUTH_GENERIC_OIDC_SECRET`, `AUTH_GENERIC_OIDC_ISSUER` |
|
|
54
|
+
| 飞书 | `feishu` | `AUTH_FEISHU_APP_ID`, `AUTH_FEISHU_APP_SECRET` |
|
|
55
|
+
| 微信 | `wechat` | `AUTH_WECHAT_ID`, `AUTH_WECHAT_SECRET` |
|
|
56
|
+
|
|
57
|
+
点击下方提供商查看详细配置指南:
|
|
88
58
|
|
|
89
|
-
|
|
59
|
+
<Cards>
|
|
60
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/github'} title={'GitHub'} />
|
|
90
61
|
|
|
91
|
-
|
|
92
|
-
| ------------------------------------- | -- | ----------------------------------------------------------------------------------------- |
|
|
93
|
-
| `NEXT_PUBLIC_AUTH_EMAIL_VERIFICATION` | 可选 | 设置为 `1` 以要求用户在登录前验证邮箱 |
|
|
94
|
-
| `EMAIL_SERVICE_PROVIDER` | 可选 | 邮件服务选择:`nodemailer`(默认,SMTP)或 `resend` |
|
|
95
|
-
| `SMTP_HOST` | 必选 | SMTP 服务器主机名(如 `smtp.gmail.com`),仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
|
96
|
-
| `SMTP_PORT` | 必选 | SMTP 服务器端口(TLS 通常为 `587`,SSL 为 `465`),仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
|
97
|
-
| `SMTP_SECURE` | 可选 | SSL 设置为 `true`(端口 465),TLS 设置为 `false`(端口 587),仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
|
98
|
-
| `SMTP_USER` | 必选 | SMTP 认证用户名,仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
|
99
|
-
| `SMTP_PASS` | 必选 | SMTP 认证密码,仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
|
100
|
-
| `RESEND_API_KEY` | 必选 | Resend API Key,`EMAIL_SERVICE_PROVIDER=resend` 时必填 |
|
|
101
|
-
| `RESEND_FROM` | 推荐 | 默认发件人地址(如 `noreply@已验证域名`),需为 Resend 已验证域名下的邮箱,`EMAIL_SERVICE_PROVIDER=resend` 时使用 |
|
|
62
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/google'} title={'Google'} />
|
|
102
63
|
|
|
103
|
-
|
|
64
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/microsoft'} title={'Microsoft'} />
|
|
104
65
|
|
|
105
|
-
|
|
66
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/apple'} title={'Apple'} />
|
|
106
67
|
|
|
107
|
-
|
|
108
|
-
| ------------------------------- | -- | ----------------- |
|
|
109
|
-
| `NEXT_PUBLIC_ENABLE_MAGIC_LINK` | 可选 | 设置为 `1` 以启用魔法链接登录 |
|
|
68
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/cognito'} title={'AWS Cognito'} />
|
|
110
69
|
|
|
111
|
-
<
|
|
112
|
-
详细的提供商配置可参考 [Next Auth 提供商文档](/zh/docs/self-hosting/advanced/auth/next-auth)(大部分配置兼容),或访问官方 [Better Auth 文档](https://www.better-auth.com/docs/introduction)。
|
|
113
|
-
</Callout>
|
|
70
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/auth0'} title={'Auth0'} />
|
|
114
71
|
|
|
115
|
-
<
|
|
116
|
-
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#better-auth) 可查阅所有 Better Auth 相关变量详情。
|
|
117
|
-
</Callout>
|
|
72
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/authelia'} title={'Authelia'} />
|
|
118
73
|
|
|
119
|
-
|
|
74
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/authentik'} title={'Authentik'} />
|
|
120
75
|
|
|
121
|
-
|
|
76
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/casdoor'} title={'Casdoor'} />
|
|
122
77
|
|
|
123
|
-
|
|
124
|
-
| -------------------------------- | -- | ------------------------------------------------------------------------------------------------------------ |
|
|
125
|
-
| `NEXT_PUBLIC_ENABLE_NEXT_AUTH` | 必选 | 用于启用 NextAuth 服务,设置为 `1` 以启用,更改此项需要重新编译应用。使用 `lobehub/lobe-chat-database` 镜像部署的用户已经默认添加了该项配置。 |
|
|
126
|
-
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令: `openssl rand -base64 32`,或者访问 `https://generate-secret.vercel.app/32` 生成秘钥。 |
|
|
127
|
-
| `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
|
|
128
|
-
| `NEXT_AUTH_SSO_PROVIDERS` | 可选 | 该环境变量用于同时启用多个身份验证源,以逗号 `,` 分割,例如 `auth0,microsoft-entra-id,authentik`。 |
|
|
129
|
-
| `NEXT_AUTH_SSO_SESSION_STRATEGY` | 可选 | Auth.js 的会话策略。选项为 `jwt` 或 `database`。默认值为 `jwt`。 |
|
|
78
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/cloudflare-zero-trust'} title={'Cloudflare Zero Trust'} />
|
|
130
79
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
<Cards>
|
|
134
|
-
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/auth0'} title={'Auth0'} />
|
|
80
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/keycloak'} title={'Keycloak'} />
|
|
135
81
|
|
|
136
|
-
<Card href={'/zh/docs/self-hosting/advanced/auth/
|
|
82
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/logto'} title={'Logto'} />
|
|
137
83
|
|
|
138
|
-
<Card href={'/zh/docs/self-hosting/advanced/auth/
|
|
84
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/okta'} title={'Okta'} />
|
|
139
85
|
|
|
140
|
-
<Card href={'/zh/docs/self-hosting/advanced/auth/
|
|
86
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/zitadel'} title={'ZITADEL'} />
|
|
141
87
|
|
|
142
|
-
<Card href={'/zh/docs/self-hosting/advanced/auth/
|
|
88
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/generic-oidc'} title={'Generic OIDC'} />
|
|
143
89
|
|
|
144
|
-
<Card href={'/zh/docs/self-hosting/advanced/auth/
|
|
90
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/feishu'} title={'飞书'} />
|
|
145
91
|
|
|
146
|
-
<Card href={'/zh/docs/self-hosting/advanced/auth/
|
|
92
|
+
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/wechat'} title={'微信'} />
|
|
93
|
+
</Cards>
|
|
147
94
|
|
|
148
|
-
|
|
95
|
+
## 回调 URL 格式
|
|
149
96
|
|
|
150
|
-
|
|
97
|
+
配置 OAuth 提供商时,请使用以下回调 URL 格式:
|
|
151
98
|
|
|
152
|
-
|
|
153
|
-
|
|
99
|
+
- **开发环境**:`http://localhost:3210/api/auth/callback/{provider}`
|
|
100
|
+
- **生产环境**:`https://yourdomain.com/api/auth/callback/{provider}`
|
|
154
101
|
|
|
155
|
-
|
|
102
|
+
## 邮件服务配置
|
|
156
103
|
|
|
157
|
-
|
|
104
|
+
用于邮箱验证、密码重置和魔法链接发送。先选择邮件服务,再填对应变量:
|
|
158
105
|
|
|
159
|
-
|
|
106
|
+
| 环境变量 | 类型 | 描述 |
|
|
107
|
+
| ------------------------- | -- | ----------------------------------------------------------------------------------------- |
|
|
108
|
+
| `AUTH_EMAIL_VERIFICATION` | 可选 | 设置为 `1` 以要求用户在登录前验证邮箱(默认关闭) |
|
|
109
|
+
| `EMAIL_SERVICE_PROVIDER` | 可选 | 邮件服务选择:`nodemailer`(默认,SMTP)或 `resend` |
|
|
110
|
+
| `SMTP_HOST` | 必选 | SMTP 服务器主机名(如 `smtp.gmail.com`),仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
|
111
|
+
| `SMTP_PORT` | 必选 | SMTP 服务器端口(TLS 通常为 `587`,SSL 为 `465`),仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
|
112
|
+
| `SMTP_SECURE` | 可选 | SSL 设置为 `true`(端口 465),TLS 设置为 `false`(端口 587),仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
|
113
|
+
| `SMTP_USER` | 必选 | SMTP 认证用户名,仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
|
114
|
+
| `SMTP_PASS` | 必选 | SMTP 认证密码,仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
|
115
|
+
| `RESEND_API_KEY` | 必选 | Resend API Key,`EMAIL_SERVICE_PROVIDER=resend` 时必填 |
|
|
116
|
+
| `RESEND_FROM` | 推荐 | 默认发件人地址(如 `noreply@已验证域名`),需为 Resend 已验证域名下的邮箱,`EMAIL_SERVICE_PROVIDER=resend` 时使用 |
|
|
160
117
|
|
|
161
|
-
|
|
118
|
+
## 魔法链接(免密)登录
|
|
162
119
|
|
|
163
|
-
|
|
164
|
-
| --------------------- | ----------------------- | --------- |
|
|
165
|
-
| Auth0 | `auth0` | |
|
|
166
|
-
| Authenlia | `authenlia` | |
|
|
167
|
-
| Authentik | `authentik` | |
|
|
168
|
-
| Casdoor | `casdoor` | `Webhook` |
|
|
169
|
-
| Cloudflare Zero Trust | `cloudflare-zero-trust` | |
|
|
170
|
-
| Github | `github` | |
|
|
171
|
-
| Logto | `logto` | `Webhook` |
|
|
172
|
-
| Microsoft Entra ID | `microsoft-entra-id` | |
|
|
173
|
-
| ZITADEL | `zitadel` | |
|
|
174
|
-
| Keycloak | `keycloak` | |
|
|
175
|
-
| Okta | `okta` | |
|
|
120
|
+
启用魔法链接登录(依赖上方已配置好的邮件服务,默认关闭):
|
|
176
121
|
|
|
177
|
-
|
|
122
|
+
| 环境变量 | 类型 | 描述 |
|
|
123
|
+
| ------------------- | -- | ----------------------- |
|
|
124
|
+
| `ENABLE_MAGIC_LINK` | 可选 | 设置为 `1` 以启用魔法链接登录(默认关闭) |
|
|
178
125
|
|
|
179
|
-
|
|
126
|
+
<Callout type={'tip'}>
|
|
127
|
+
前往 [环境变量](/zh/docs/self-hosting/environment-variables/auth#better-auth) 可查阅所有 Better Auth 相关变量详情。
|
|
128
|
+
</Callout>
|
|
180
129
|
|
|
181
|
-
|
|
130
|
+
## 常见问题
|
|
182
131
|
|
|
183
|
-
###
|
|
132
|
+
### Better Auth 支持哪些 SSO 提供商?
|
|
184
133
|
|
|
185
|
-
|
|
134
|
+
Better Auth 支持内置提供商(Google、GitHub、Microsoft、Apple、AWS Cognito)和通用 OIDC 提供商(Auth0、Authelia、Authentik、Casdoor、Cloudflare Zero Trust、Keycloak、Logto、Okta、ZITADEL、Generic OIDC、飞书、微信)。
|
|
186
135
|
|
|
187
|
-
|
|
136
|
+
### 如何启用多个 SSO 提供商?
|
|
188
137
|
|
|
189
|
-
|
|
138
|
+
设置 `AUTH_SSO_PROVIDERS` 环境变量,使用逗号分隔多个提供商,例如 `google,github,microsoft`。顺序决定登录页面上的显示顺序。
|
|
@@ -44,11 +44,17 @@ Before connecting the desktop to your self-hosted instance, ensure that your sel
|
|
|
44
44
|
|
|
45
45
|
#### OIDC Environment Variable Configuration
|
|
46
46
|
|
|
47
|
-
You need to add the following two environment variables, `ENABLE_OIDC` and `JWKS_KEY`, to your self-hosted instance
|
|
47
|
+
You need to add the following two environment variables, `ENABLE_OIDC` and `JWKS_KEY`, to your self-hosted instance:
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
```bash
|
|
50
|
+
ENABLE_OIDC=1
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Click the button below to generate `JWKS_KEY`:
|
|
54
|
+
|
|
55
|
+
<GenerateJWKSKey />
|
|
50
56
|
|
|
51
|
-
Add the generated
|
|
57
|
+
Add the generated environment variables to your deployment configuration.
|
|
52
58
|
|
|
53
59
|
<Callout>If you have already configured `OIDC_JWKS_KEY`, no changes are needed. The system will automatically fall back to `OIDC_JWKS_KEY` for backward compatibility.</Callout>
|
|
54
60
|
|