@lobehub/lobehub 2.1.0 → 2.1.2
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 +50 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/apps/desktop/src/main/controllers/McpInstallCtr.ts +10 -10
- package/apps/desktop/src/main/controllers/NetworkProxyCtr.ts +6 -6
- package/apps/desktop/src/main/controllers/RemoteServerSyncCtr.ts +2 -2
- package/changelog/v2.json +18 -0
- package/docker-compose/deploy/.env.example +35 -0
- package/docker-compose/deploy/.env.zh-CN.example +31 -0
- package/docker-compose/deploy/bucket.config.json +18 -0
- package/docker-compose/deploy/docker-compose.yml +148 -0
- package/docker-compose/deploy/searxng-settings.yml +2582 -0
- package/docker-compose/setup.sh +37 -88
- package/docs/changelog/2025-03-02-new-models.mdx +1 -1
- package/docs/changelog/2025-03-02-new-models.zh-CN.mdx +1 -1
- package/docs/changelog/2025-04-06-exports.mdx +1 -1
- package/docs/changelog/2025-04-06-exports.zh-CN.mdx +1 -1
- package/docs/changelog/2025-05-08-desktop-app.mdx +2 -2
- package/docs/changelog/2025-05-08-desktop-app.zh-CN.mdx +2 -2
- package/docs/changelog/2025-06-08-claude-4.mdx +1 -1
- package/docs/changelog/2025-06-08-claude-4.zh-CN.mdx +1 -1
- package/docs/changelog/2025-07-08-mcp-market.mdx +1 -1
- package/docs/changelog/2025-07-08-mcp-market.zh-CN.mdx +1 -1
- package/docs/changelog/2025-08-08-image-generation.mdx +1 -1
- package/docs/changelog/2025-08-08-image-generation.zh-CN.mdx +1 -1
- package/docs/changelog/2025-09-08-gemini.mdx +1 -1
- package/docs/changelog/2025-09-08-gemini.zh-CN.mdx +1 -1
- package/docs/changelog/2025-10-08-python.mdx +1 -1
- package/docs/changelog/2025-10-08-python.zh-CN.mdx +1 -1
- package/docs/changelog/2025-11-08-comfy-ui.mdx +1 -1
- package/docs/changelog/2025-11-08-comfy-ui.zh-CN.mdx +1 -1
- package/docs/changelog/2025-12-20-mcp.mdx +1 -1
- package/docs/changelog/2025-12-20-mcp.zh-CN.mdx +1 -1
- package/docs/development/basic/add-new-authentication-providers.zh-CN.mdx +1 -1
- package/docs/development/basic/add-new-image-model.mdx +3 -3
- package/docs/development/basic/add-new-image-model.zh-CN.mdx +3 -3
- package/docs/development/basic/chat-api.mdx +10 -10
- package/docs/development/basic/chat-api.zh-CN.mdx +10 -10
- package/docs/development/basic/feature-development.mdx +4 -4
- package/docs/development/basic/feature-development.zh-CN.mdx +4 -4
- package/docs/development/basic/setup-development.mdx +4 -4
- package/docs/development/basic/setup-development.zh-CN.mdx +4 -4
- package/docs/development/internationalization/add-new-locale.mdx +1 -1
- package/docs/development/internationalization/add-new-locale.zh-CN.mdx +1 -1
- package/docs/development/internationalization/internationalization-implementation.mdx +5 -5
- package/docs/development/internationalization/internationalization-implementation.zh-CN.mdx +5 -5
- package/docs/development/others/lighthouse.mdx +8 -8
- package/docs/development/others/lighthouse.zh-CN.mdx +8 -8
- package/docs/development/start.mdx +3 -3
- package/docs/development/start.zh-CN.mdx +3 -3
- package/docs/self-hosting/advanced/feature-flags.mdx +1 -1
- package/docs/self-hosting/advanced/feature-flags.zh-CN.mdx +1 -1
- package/docs/self-hosting/advanced/knowledge-base.mdx +2 -2
- package/docs/self-hosting/advanced/knowledge-base.zh-CN.mdx +2 -2
- package/docs/self-hosting/advanced/online-search.mdx +1 -1
- package/docs/self-hosting/advanced/online-search.zh-CN.mdx +1 -1
- package/docs/self-hosting/advanced/redis/upstash.mdx +3 -3
- package/docs/self-hosting/advanced/redis/upstash.zh-CN.mdx +3 -3
- package/docs/self-hosting/advanced/redis.mdx +6 -6
- package/docs/self-hosting/advanced/redis.zh-CN.mdx +6 -6
- package/docs/self-hosting/advanced/s3/rustfs.mdx +116 -116
- package/docs/self-hosting/advanced/s3/rustfs.zh-CN.mdx +116 -117
- package/docs/self-hosting/advanced/upstream-sync.zh-CN.mdx +5 -5
- package/docs/self-hosting/auth/email.mdx +70 -0
- package/docs/self-hosting/auth/email.zh-CN.mdx +70 -0
- package/docs/self-hosting/{advanced/auth → auth}/legacy.mdx +10 -10
- package/docs/self-hosting/{advanced/auth → auth}/legacy.zh-CN.mdx +5 -5
- package/docs/self-hosting/{advanced/auth → auth}/next-auth/casdoor.zh-CN.mdx +3 -3
- package/docs/self-hosting/{advanced/auth → auth}/next-auth/keycloak.zh-CN.mdx +2 -2
- package/docs/self-hosting/{advanced/auth → auth}/next-auth/logto.zh-CN.mdx +2 -2
- package/docs/self-hosting/{advanced/auth → auth}/providers/apple.mdx +6 -6
- package/docs/self-hosting/{advanced/auth → auth}/providers/apple.zh-CN.mdx +6 -6
- package/docs/self-hosting/{advanced/auth → auth}/providers/auth0.mdx +12 -12
- package/docs/self-hosting/{advanced/auth → auth}/providers/auth0.zh-CN.mdx +12 -12
- package/docs/self-hosting/{advanced/auth → auth}/providers/authelia.mdx +13 -13
- package/docs/self-hosting/{advanced/auth → auth}/providers/authelia.zh-CN.mdx +13 -13
- package/docs/self-hosting/{advanced/auth → auth}/providers/authentik.mdx +13 -13
- package/docs/self-hosting/{advanced/auth → auth}/providers/authentik.zh-CN.mdx +13 -13
- package/docs/self-hosting/auth/providers/casdoor.mdx +197 -0
- package/docs/self-hosting/auth/providers/casdoor.zh-CN.mdx +248 -0
- package/docs/self-hosting/{advanced/auth → auth}/providers/cloudflare-zero-trust.mdx +7 -7
- package/docs/self-hosting/{advanced/auth → auth}/providers/cloudflare-zero-trust.zh-CN.mdx +6 -6
- package/docs/self-hosting/{advanced/auth → auth}/providers/cognito.mdx +13 -13
- package/docs/self-hosting/{advanced/auth → auth}/providers/cognito.zh-CN.mdx +13 -13
- package/docs/self-hosting/{advanced/auth → auth}/providers/feishu.mdx +10 -10
- package/docs/self-hosting/{advanced/auth → auth}/providers/feishu.zh-CN.mdx +10 -10
- package/docs/self-hosting/{advanced/auth → auth}/providers/generic-oidc.mdx +12 -12
- package/docs/self-hosting/{advanced/auth → auth}/providers/generic-oidc.zh-CN.mdx +12 -12
- package/docs/self-hosting/{advanced/auth → auth}/providers/github.mdx +10 -10
- package/docs/self-hosting/{advanced/auth → auth}/providers/github.zh-CN.mdx +10 -10
- package/docs/self-hosting/{advanced/auth → auth}/providers/google.mdx +10 -10
- package/docs/self-hosting/{advanced/auth → auth}/providers/google.zh-CN.mdx +10 -10
- package/docs/self-hosting/{advanced/auth → auth}/providers/keycloak.mdx +11 -11
- package/docs/self-hosting/{advanced/auth → auth}/providers/keycloak.zh-CN.mdx +11 -11
- package/docs/self-hosting/{advanced/auth → auth}/providers/logto.mdx +8 -8
- package/docs/self-hosting/{advanced/auth → auth}/providers/logto.zh-CN.mdx +7 -7
- package/docs/self-hosting/{advanced/auth → auth}/providers/microsoft.mdx +11 -11
- package/docs/self-hosting/{advanced/auth → auth}/providers/microsoft.zh-CN.mdx +11 -11
- package/docs/self-hosting/{advanced/auth → auth}/providers/okta.mdx +13 -13
- package/docs/self-hosting/{advanced/auth → auth}/providers/okta.zh-CN.mdx +13 -13
- package/docs/self-hosting/{advanced/auth → auth}/providers/wechat.mdx +10 -10
- package/docs/self-hosting/{advanced/auth → auth}/providers/wechat.zh-CN.mdx +10 -10
- package/docs/self-hosting/{advanced/auth → auth}/providers/zitadel.mdx +13 -13
- package/docs/self-hosting/{advanced/auth → auth}/providers/zitadel.zh-CN.mdx +13 -13
- package/docs/self-hosting/{advanced/auth.mdx → auth.mdx} +12 -81
- package/docs/self-hosting/{advanced/auth.zh-CN.mdx → auth.zh-CN.mdx} +11 -80
- package/docs/self-hosting/environment-variables/redis.mdx +1 -1
- package/docs/self-hosting/environment-variables/redis.zh-CN.mdx +1 -1
- package/docs/self-hosting/environment-variables.mdx +1 -1
- package/docs/self-hosting/faq/no-v1-suffix.mdx +3 -3
- package/docs/self-hosting/faq/no-v1-suffix.zh-CN.mdx +3 -3
- package/docs/self-hosting/{advanced → migration/v2}/auth/clerk-to-betterauth.mdx +7 -7
- package/docs/self-hosting/{advanced → migration/v2}/auth/clerk-to-betterauth.zh-CN.mdx +7 -7
- package/docs/self-hosting/{advanced → migration/v2}/auth/migration-internals.mdx +2 -2
- package/docs/self-hosting/{advanced → migration/v2}/auth/migration-internals.zh-CN.mdx +2 -2
- package/docs/self-hosting/{advanced → migration/v2}/auth/nextauth-to-betterauth.mdx +11 -11
- package/docs/self-hosting/{advanced → migration/v2}/auth/nextauth-to-betterauth.zh-CN.mdx +11 -11
- package/docs/self-hosting/migration/v2/breaking-changes.mdx +1 -1
- package/docs/self-hosting/migration/v2/breaking-changes.zh-CN.mdx +1 -1
- package/docs/self-hosting/platform/docker-compose.mdx +43 -561
- package/docs/self-hosting/platform/docker-compose.zh-CN.mdx +43 -540
- package/docs/self-hosting/platform/docker.mdx +5 -5
- package/docs/self-hosting/platform/docker.zh-CN.mdx +10 -10
- package/docs/self-hosting/platform/dokploy.mdx +1 -1
- package/docs/self-hosting/platform/dokploy.zh-CN.mdx +5 -5
- package/docs/self-hosting/platform/sealos.mdx +12 -12
- package/docs/self-hosting/platform/sealos.zh-CN.mdx +17 -17
- package/docs/self-hosting/platform/vercel.zh-CN.mdx +4 -4
- package/docs/self-hosting/start.mdx +3 -3
- package/docs/self-hosting/start.zh-CN.mdx +4 -4
- package/locales/en-US/auth.json +1 -1
- package/locales/en-US/authError.json +1 -0
- package/locales/en-US/metadata.json +1 -1
- package/locales/zh-CN/authError.json +1 -0
- package/package.json +1 -1
- package/packages/const/src/url.ts +1 -1
- package/src/app/[variants]/(auth)/auth-error/page.tsx +4 -2
- package/src/app/[variants]/(auth)/signin/SignInEmailStep.tsx +1 -1
- package/src/app/[variants]/(auth)/signin/SignInPasswordStep.tsx +1 -1
- package/src/features/Conversation/Messages/AssistantGroup/components/MessageContent.tsx +6 -1
- package/src/libs/better-auth/sso/providers/feishu.ts +15 -14
- package/src/libs/better-auth/sso/providers/wechat.ts +6 -3
- package/src/libs/next/proxy/define-config.ts +1 -0
- package/src/locales/default/auth.ts +1 -1
- package/src/locales/default/authError.ts +2 -0
- package/src/locales/default/metadata.ts +1 -1
- package/src/server/ld.ts +1 -1
- package/docs/self-hosting/advanced/auth/providers/casdoor.mdx +0 -87
- package/docs/self-hosting/advanced/auth/providers/casdoor.zh-CN.mdx +0 -83
- /package/docs/self-hosting/{advanced/auth → auth}/clerk.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/clerk.zh-CN.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/auth0.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/auth0.zh-CN.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/authelia.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/authelia.zh-CN.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/authentik.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/authentik.zh-CN.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/casdoor.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/cloudflare-zero-trust.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/cloudflare-zero-trust.zh-CN.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/github.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/github.zh-CN.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/google.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/google.zh-CN.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/keycloak.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/logto.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/microsoft-entra-id.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/microsoft-entra-id.zh-CN.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/okta.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/okta.zh-CN.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/wechat.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/wechat.zh-CN.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/zitadel.mdx +0 -0
- /package/docs/self-hosting/{advanced/auth → auth}/next-auth/zitadel.zh-CN.mdx +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Migrating from Clerk to Better Auth
|
|
3
3
|
description: >-
|
|
4
|
-
Guide for migrating your
|
|
4
|
+
Guide for migrating your LobeHub deployment from Clerk authentication to
|
|
5
5
|
Better Auth, including simple and full migration options.
|
|
6
6
|
tags:
|
|
7
7
|
- Authentication Service
|
|
@@ -12,17 +12,17 @@ tags:
|
|
|
12
12
|
|
|
13
13
|
# Migrating from Clerk to Better Auth
|
|
14
14
|
|
|
15
|
-
This guide helps you migrate your existing Clerk-based
|
|
15
|
+
This guide helps you migrate your existing Clerk-based LobeHub deployment to Better Auth.
|
|
16
16
|
|
|
17
17
|
<Callout type={'info'}>
|
|
18
|
-
Better Auth is the recommended authentication solution for
|
|
18
|
+
Better Auth is the recommended authentication solution for LobeHub. It offers simpler configuration, more SSO providers, and better self-hosting support.
|
|
19
19
|
</Callout>
|
|
20
20
|
|
|
21
21
|
<Callout type={'error'}>
|
|
22
22
|
**Important Notice**:
|
|
23
23
|
|
|
24
24
|
- **Always backup your database first!** For Neon users, create a backup via [Fork Branch](https://neon.tech/docs/manage/branches#create-a-branch)
|
|
25
|
-
-
|
|
25
|
+
- LobeHub is not responsible for any data loss or issues that may occur during the migration process
|
|
26
26
|
- This guide is intended for users with development experience; not recommended for users without technical background
|
|
27
27
|
- If you have any questions, feel free to ask in our [Discord](https://discord.com/invite/AYFPHvv2jT) community or [GitHub Issue](https://github.com/lobehub/lobe-chat/issues/11707)
|
|
28
28
|
</Callout>
|
|
@@ -83,7 +83,7 @@ For small self-hosted deployments, the simplest approach is to let users reset t
|
|
|
83
83
|
See [Authentication Service Configuration](/docs/self-hosting/advanced/auth) for complete environment variables and SSO provider setup.
|
|
84
84
|
</Callout>
|
|
85
85
|
|
|
86
|
-
3. **Redeploy
|
|
86
|
+
3. **Redeploy LobeHub**
|
|
87
87
|
|
|
88
88
|
Deploy the new version with Better Auth enabled.
|
|
89
89
|
|
|
@@ -102,7 +102,7 @@ For small self-hosted deployments, the simplest approach is to let users reset t
|
|
|
102
102
|
- Log in using their previously linked social account (e.g., Google, GitHub)
|
|
103
103
|
- Click "Set Password" to receive an email and set a new password
|
|
104
104
|
|
|
105
|
-

|
|
106
106
|
|
|
107
107
|
3. (Optional) After logging in, users can manage their account in the Profile page:
|
|
108
108
|
- Linked Accounts: Link additional social accounts
|
|
@@ -139,7 +139,7 @@ For larger deployments or when you need to preserve user passwords and SSO conne
|
|
|
139
139
|
|
|
140
140
|
**Preparation:**
|
|
141
141
|
|
|
142
|
-
1. Clone the
|
|
142
|
+
1. Clone the LobeHub repository and install dependencies:
|
|
143
143
|
|
|
144
144
|
```bash
|
|
145
145
|
git clone https://github.com/lobehub/lobe-chat.git
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: 从 Clerk 迁移到 Better Auth
|
|
3
|
-
description: 将
|
|
3
|
+
description: 将 LobeHub 部署从 Clerk 身份验证迁移到 Better Auth 的指南,包括简单迁移和完整迁移选项。
|
|
4
4
|
tags:
|
|
5
5
|
- 身份验证服务
|
|
6
6
|
- Better Auth
|
|
@@ -10,17 +10,17 @@ tags:
|
|
|
10
10
|
|
|
11
11
|
# 从 Clerk 迁移到 Better Auth
|
|
12
12
|
|
|
13
|
-
本指南帮助您将现有的基于 Clerk 的
|
|
13
|
+
本指南帮助您将现有的基于 Clerk 的 LobeHub 部署迁移到 Better Auth。
|
|
14
14
|
|
|
15
15
|
<Callout type={'info'}>
|
|
16
|
-
Better Auth 是
|
|
16
|
+
Better Auth 是 LobeHub 推荐的身份验证解决方案。它提供更简单的配置、更多的 SSO 提供商支持,以及更好的自托管体验。
|
|
17
17
|
</Callout>
|
|
18
18
|
|
|
19
19
|
<Callout type={'error'}>
|
|
20
20
|
**重要提醒**:
|
|
21
21
|
|
|
22
22
|
- **务必先备份数据库**!如使用 Neon,可通过 [Fork 分支](https://neon.tech/docs/manage/branches#create-a-branch) 创建备份
|
|
23
|
-
- 迁移过程中可能出现的任何数据丢失或问题,
|
|
23
|
+
- 迁移过程中可能出现的任何数据丢失或问题,LobeHub 概不负责
|
|
24
24
|
- 本指南适合有一定开发背景的用户,不建议无技术经验的用户自行操作
|
|
25
25
|
- 如有任何疑问,欢迎到 [Discord](https://discord.com/invite/AYFPHvv2jT) 社区或 [GitHub Issue](https://github.com/lobehub/lobe-chat/issues/11707) 提问
|
|
26
26
|
</Callout>
|
|
@@ -81,7 +81,7 @@ tags:
|
|
|
81
81
|
查阅 [身份验证服务配置](/zh/docs/self-hosting/advanced/auth) 了解完整的环境变量和 SSO 提供商配置。
|
|
82
82
|
</Callout>
|
|
83
83
|
|
|
84
|
-
3. **重新部署
|
|
84
|
+
3. **重新部署 LobeHub**
|
|
85
85
|
|
|
86
86
|
部署启用 Better Auth 的新版本。
|
|
87
87
|
|
|
@@ -99,7 +99,7 @@ tags:
|
|
|
99
99
|
- 使用之前关联的社交账号(如 Google、GitHub)登录
|
|
100
100
|
- 点击「设置密码」链接,通过邮件设置新密码后登录
|
|
101
101
|
|
|
102
|
-

|
|
103
103
|
|
|
104
104
|
3. (可选)登录后可在个人资料页进行以下操作:
|
|
105
105
|
- 已关联账号:手动关联其他社交账号
|
|
@@ -134,7 +134,7 @@ tags:
|
|
|
134
134
|
|
|
135
135
|
**准备工作:**
|
|
136
136
|
|
|
137
|
-
1. Clone
|
|
137
|
+
1. Clone LobeHub 仓库并安装依赖:
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
140
|
git clone https://github.com/lobehub/lobe-chat.git
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Understanding Auth Migration - Technical Deep Dive
|
|
3
3
|
description: >-
|
|
4
|
-
Technical explanation of how authentication migration works in
|
|
4
|
+
Technical explanation of how authentication migration works in LobeHub,
|
|
5
5
|
including database schema, migration principles, and troubleshooting guide.
|
|
6
6
|
tags:
|
|
7
7
|
- Authentication
|
|
@@ -12,7 +12,7 @@ tags:
|
|
|
12
12
|
|
|
13
13
|
# Understanding Auth Migration
|
|
14
14
|
|
|
15
|
-
This document explains the technical principles behind authentication migration in
|
|
15
|
+
This document explains the technical principles behind authentication migration in LobeHub. It's intended for users with database and development experience who want to understand how migration works under the hood.
|
|
16
16
|
|
|
17
17
|
<Callout type={'info'}>
|
|
18
18
|
For step-by-step migration instructions, see [NextAuth Migration](/docs/self-hosting/advanced/auth/nextauth-to-betterauth) or [Clerk Migration](/docs/self-hosting/advanced/auth/clerk-to-betterauth).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: 认证迁移原理 - 技术深入解析
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
4
|
+
LobeHub 认证迁移的技术原理解析,包括数据库 Schema、迁移原理和问题排查指南。
|
|
5
5
|
tags:
|
|
6
6
|
- 认证
|
|
7
7
|
- 迁移
|
|
@@ -11,7 +11,7 @@ tags:
|
|
|
11
11
|
|
|
12
12
|
# 认证迁移原理
|
|
13
13
|
|
|
14
|
-
本文档解释
|
|
14
|
+
本文档解释 LobeHub 认证迁移的技术原理,适合有数据库和开发经验的用户,帮助理解迁移的底层逻辑。
|
|
15
15
|
|
|
16
16
|
<Callout type={'info'}>
|
|
17
17
|
如需分步迁移指南,请参阅 [NextAuth 迁移](/docs/self-hosting/advanced/auth/nextauth-to-betterauth) 或 [Clerk 迁移](/docs/self-hosting/advanced/auth/clerk-to-betterauth)。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Migrating from NextAuth to Better Auth
|
|
3
3
|
description: >-
|
|
4
|
-
Guide for migrating your
|
|
4
|
+
Guide for migrating your LobeHub deployment from NextAuth authentication to
|
|
5
5
|
Better Auth, including simple and full migration options.
|
|
6
6
|
tags:
|
|
7
7
|
- Authentication Service
|
|
@@ -12,17 +12,17 @@ tags:
|
|
|
12
12
|
|
|
13
13
|
# Migrating from NextAuth to Better Auth
|
|
14
14
|
|
|
15
|
-
This guide helps you migrate your existing NextAuth-based
|
|
15
|
+
This guide helps you migrate your existing NextAuth-based LobeHub deployment to Better Auth.
|
|
16
16
|
|
|
17
17
|
<Callout type={'info'}>
|
|
18
|
-
Better Auth is the recommended authentication solution for
|
|
18
|
+
Better Auth is the recommended authentication solution for LobeHub. It offers simpler configuration, more SSO providers, and better self-hosting support.
|
|
19
19
|
</Callout>
|
|
20
20
|
|
|
21
21
|
<Callout type={'error'}>
|
|
22
22
|
**Important Notice**:
|
|
23
23
|
|
|
24
24
|
- **Always backup your database first!** For Neon users, create a backup via [Fork Branch](https://neon.tech/docs/manage/branches#create-a-branch)
|
|
25
|
-
-
|
|
25
|
+
- LobeHub is not responsible for any data loss or issues that may occur during the migration process
|
|
26
26
|
- This guide is intended for users with development experience; not recommended for users without technical background
|
|
27
27
|
- If you have any questions, feel free to ask in our [Discord](https://discord.com/invite/AYFPHvv2jT) community or [GitHub Issue](https://github.com/lobehub/lobe-chat/issues)
|
|
28
28
|
</Callout>
|
|
@@ -136,7 +136,7 @@ For small self-hosted deployments, the simplest approach is to let users re-logi
|
|
|
136
136
|
See [Authentication Service Configuration](/docs/self-hosting/advanced/auth) for complete environment variables and SSO provider setup.
|
|
137
137
|
</Callout>
|
|
138
138
|
|
|
139
|
-
2. **Redeploy
|
|
139
|
+
2. **Redeploy LobeHub**
|
|
140
140
|
|
|
141
141
|
Deploy the new version with Better Auth enabled.
|
|
142
142
|
|
|
@@ -172,7 +172,7 @@ For larger deployments or when you need to preserve SSO connections, use the mig
|
|
|
172
172
|
|
|
173
173
|
**Preparation:**
|
|
174
174
|
|
|
175
|
-
1. Clone the
|
|
175
|
+
1. Clone the LobeHub repository and install dependencies:
|
|
176
176
|
|
|
177
177
|
```bash
|
|
178
178
|
git clone https://github.com/lobehub/lobe-chat.git
|
|
@@ -337,7 +337,7 @@ This error occurs because the database schema is outdated. Run `pnpm db:migrate`
|
|
|
337
337
|
|
|
338
338
|
### email\_not\_found error
|
|
339
339
|
|
|
340
|
-
If you see a redirect to `signin?callbackUrl=...&error=email_not_found`, it means
|
|
340
|
+
If you see a redirect to `signin?callbackUrl=...&error=email_not_found`, it means LobeHub cannot get the user's email.
|
|
341
341
|
|
|
342
342
|
<Callout type={'warning'}>
|
|
343
343
|
**Important**: Better Auth currently **requires user email** for authentication. All SSO providers must be configured to return email information, otherwise users cannot log in.
|
|
@@ -347,23 +347,23 @@ Common causes:
|
|
|
347
347
|
|
|
348
348
|
**Cause 1: SSO connection not requesting email permission**
|
|
349
349
|
|
|
350
|
-
When configuring SSO connections (e.g., GitHub in Auth0), make sure to enable **Email Address** permission in the Attributes section.
|
|
350
|
+
When configuring SSO connections (e.g., GitHub in Auth0), make sure to enable **Email Address** permission in the Attributes section. LobeHub requires user email for authentication.
|
|
351
351
|
|
|
352
352
|
**Cause 2: User email not configured in identity provider**
|
|
353
353
|
|
|
354
354
|
For identity providers like Casdoor or Logto, users may not have an email configured.
|
|
355
355
|
|
|
356
356
|
<Callout type={'warning'}>
|
|
357
|
-
**Note for Casdoor Users**: Casdoor does not require users to have an email configured, but
|
|
357
|
+
**Note for Casdoor Users**: Casdoor does not require users to have an email configured, but LobeHub strongly depends on email for authentication. If you find migration difficult due to many users without email addresses, we recommend staying on [v2.0.0-next.344](https://github.com/lobehub/lobe-chat/releases/tag/v2.0.0-next.344) for now. We plan to provide a self-service migration feature in the future, where users without email will be redirected to a bind-email page when they log in.
|
|
358
358
|
</Callout>
|
|
359
359
|
|
|
360
360
|
Solution:
|
|
361
361
|
|
|
362
|
-
1. First configure the Webhook in
|
|
362
|
+
1. First configure the Webhook in LobeHub to sync user data from the identity provider:
|
|
363
363
|
- [Casdoor Webhook Configuration](/docs/self-hosting/advanced/auth/providers/casdoor)
|
|
364
364
|
- [Logto Webhook Configuration](/docs/self-hosting/advanced/auth/providers/logto)
|
|
365
365
|
2. Then configure the user's email in the identity provider's admin console
|
|
366
|
-
3. The user data will be synced to
|
|
366
|
+
3. The user data will be synced to LobeHub via Webhook, and the user can then log in
|
|
367
367
|
|
|
368
368
|
## Related Reading
|
|
369
369
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: 从 NextAuth 迁移到 Better Auth
|
|
3
|
-
description: 将
|
|
3
|
+
description: 将 LobeHub 部署从 NextAuth 身份验证迁移到 Better Auth 的指南,包括简单迁移和完整迁移选项。
|
|
4
4
|
tags:
|
|
5
5
|
- 身份验证服务
|
|
6
6
|
- Better Auth
|
|
@@ -10,17 +10,17 @@ tags:
|
|
|
10
10
|
|
|
11
11
|
# 从 NextAuth 迁移到 Better Auth
|
|
12
12
|
|
|
13
|
-
本指南帮助您将现有的基于 NextAuth 的
|
|
13
|
+
本指南帮助您将现有的基于 NextAuth 的 LobeHub 部署迁移到 Better Auth。
|
|
14
14
|
|
|
15
15
|
<Callout type={'info'}>
|
|
16
|
-
Better Auth 是
|
|
16
|
+
Better Auth 是 LobeHub 推荐的身份验证解决方案。它提供更简单的配置、更多的 SSO 提供商支持,以及更好的自托管体验。
|
|
17
17
|
</Callout>
|
|
18
18
|
|
|
19
19
|
<Callout type={'error'}>
|
|
20
20
|
**重要提醒**:
|
|
21
21
|
|
|
22
22
|
- **务必先备份数据库**!如使用 Neon,可通过 [Fork 分支](https://neon.tech/docs/manage/branches#create-a-branch) 创建备份
|
|
23
|
-
- 迁移过程中可能出现的任何数据丢失或问题,
|
|
23
|
+
- 迁移过程中可能出现的任何数据丢失或问题,LobeHub 概不负责
|
|
24
24
|
- 本指南适合有一定开发背景的用户,不建议无技术经验的用户自行操作
|
|
25
25
|
- 如有任何疑问,欢迎到 [Discord](https://discord.com/invite/AYFPHvv2jT) 社区或 [GitHub Issue](https://github.com/lobehub/lobe-chat/issues) 提问
|
|
26
26
|
</Callout>
|
|
@@ -131,7 +131,7 @@ Better Auth 支持更多功能,以下是新增的环境变量:
|
|
|
131
131
|
查阅 [身份验证服务配置](/zh/docs/self-hosting/advanced/auth) 了解完整的环境变量和 SSO 提供商配置。
|
|
132
132
|
</Callout>
|
|
133
133
|
|
|
134
|
-
2. **重新部署
|
|
134
|
+
2. **重新部署 LobeHub**
|
|
135
135
|
|
|
136
136
|
部署启用 Better Auth 的新版本。
|
|
137
137
|
|
|
@@ -167,7 +167,7 @@ Better Auth 支持更多功能,以下是新增的环境变量:
|
|
|
167
167
|
|
|
168
168
|
**准备工作:**
|
|
169
169
|
|
|
170
|
-
1. Clone
|
|
170
|
+
1. Clone LobeHub 仓库并安装依赖:
|
|
171
171
|
|
|
172
172
|
```bash
|
|
173
173
|
git clone https://github.com/lobehub/lobe-chat.git
|
|
@@ -331,7 +331,7 @@ npx tsx scripts/nextauth-to-betterauth/verify.ts
|
|
|
331
331
|
|
|
332
332
|
### email\_not\_found 错误
|
|
333
333
|
|
|
334
|
-
如果登录时跳转到 `signin?callbackUrl=...&error=email_not_found`,说明
|
|
334
|
+
如果登录时跳转到 `signin?callbackUrl=...&error=email_not_found`,说明 LobeHub 无法获取用户邮箱。
|
|
335
335
|
|
|
336
336
|
<Callout type={'warning'}>
|
|
337
337
|
**重要提示**:Better Auth 目前**强依赖用户邮箱**进行身份认证。所有 SSO 提供商必须配置为返回邮箱信息,否则用户无法登录。
|
|
@@ -341,23 +341,23 @@ npx tsx scripts/nextauth-to-betterauth/verify.ts
|
|
|
341
341
|
|
|
342
342
|
**原因 1:SSO 连接未请求邮箱权限**
|
|
343
343
|
|
|
344
|
-
配置 SSO 连接时(如 Auth0 中的 GitHub 连接),务必在 **Attributes** 部分勾选 **Email Address** 权限。
|
|
344
|
+
配置 SSO 连接时(如 Auth0 中的 GitHub 连接),务必在 **Attributes** 部分勾选 **Email Address** 权限。LobeHub 需要用户邮箱进行身份认证。
|
|
345
345
|
|
|
346
346
|
**原因 2:用户在身份提供商中未配置邮箱**
|
|
347
347
|
|
|
348
348
|
对于 Casdoor、Logto 等身份提供商,用户可能没有配置邮箱。
|
|
349
349
|
|
|
350
350
|
<Callout type={'warning'}>
|
|
351
|
-
**Casdoor 用户注意**:Casdoor 不要求用户必须配置邮箱,但
|
|
351
|
+
**Casdoor 用户注意**:Casdoor 不要求用户必须配置邮箱,但 LobeHub 强依赖邮箱进行身份认证。如果因为大量用户没有邮箱而感觉迁移困难,建议暂时停留在 [v2.0.0-next.344](https://github.com/lobehub/lobe-chat/releases/tag/v2.0.0-next.344) 版本。后续官方计划提供用户端自助迁移功能,届时没有邮箱的用户登录时会被重定向到绑定邮箱页面。
|
|
352
352
|
</Callout>
|
|
353
353
|
|
|
354
354
|
解决方案:
|
|
355
355
|
|
|
356
|
-
1. 先在
|
|
356
|
+
1. 先在 LobeHub 中配置身份提供商的 Webhook 以同步用户数据:
|
|
357
357
|
- [Casdoor Webhook 配置](/zh/docs/self-hosting/advanced/auth/providers/casdoor)
|
|
358
358
|
- [Logto Webhook 配置](/zh/docs/self-hosting/advanced/auth/providers/logto)
|
|
359
359
|
2. 然后在身份提供商的管理后台为用户配置邮箱
|
|
360
|
-
3. 用户数据通过 Webhook 同步到
|
|
360
|
+
3. 用户数据通过 Webhook 同步到 LobeHub 后即可正常登录
|
|
361
361
|
|
|
362
362
|
## 相关阅读
|
|
363
363
|
|
|
@@ -78,4 +78,4 @@ LobeHub 2.0 recommends using **PostgreSQL 17** or higher.
|
|
|
78
78
|
|
|
79
79
|
This is because LobeHub 2.0 uses the [pg\_search](https://github.com/paradedb/paradedb/tree/main/pg_search) extension for full-text search capabilities. If you use Serverless Postgres services like Neon, the pg\_search extension is only available on PostgreSQL 17.
|
|
80
80
|
|
|
81
|
-
If you self-host your database with Docker, we recommend using the `
|
|
81
|
+
If you self-host your database with Docker, we recommend using the `paradedb/paradedb:latest-pg17` image.
|
|
@@ -76,4 +76,4 @@ LobeHub 2.0 推荐使用 **PostgreSQL 17** 及以上版本。
|
|
|
76
76
|
|
|
77
77
|
这是因为 LobeHub 2.0 使用了 [pg\_search](https://github.com/paradedb/paradedb/tree/main/pg_search) 插件来提供全文搜索能力。如果您使用 Neon 等 Serverless Postgres 服务,pg\_search 插件仅在 PostgreSQL 17 上可用。
|
|
78
78
|
|
|
79
|
-
如果您使用 Docker 自建数据库,推荐使用 `
|
|
79
|
+
如果您使用 Docker 自建数据库,推荐使用 `paradedb/paradedb:latest-pg17` 镜像。
|