Files
lobehub__lobehub/docs/self-hosting/auth/next-auth/github.zh-CN.mdx
YuTengjing 191f3fe776 📝 docs: fix outdated content across the docs site (#16964)
* 📝 docs: fix outdated content across the docs site

Audited docs/ against the current codebase and fixed stale content that
drifted after major refactors (Clerk/NextAuth → Better Auth, src/server →
apps/server, src/{config,envs,locales} → packages/*, model-bank updates).

- self-hosting/auth: mark removed NextAuth/Clerk pages with deprecation
  warnings; fix microsoft/zitadel alias claims and the Logto callback path
- environment-variables & advanced: correct wrong defaults (S3_SET_ACL,
  AI_IMAGE_DEFAULT_IMAGE_NUM, index/proxy URLs), drop non-existent env vars
  and fictional feature flags, fix OIDC config guidance
- development: update refactored paths, Better Auth, .mjs configs, remove
  the MSW section (msw is not a dependency)
- providers & model examples: replace retired model ids with in-bank ones;
  fix comfyui frontmatter corruption
- usage: rename Moderator→Orchestrator, GTD→Task, correct shortcut keys,
  channel capability tables, Feishu/Lark WebSocket mode
- platform/migration: fix dead links, docker service name, npx/npm → bun

EN and zh-CN pairs updated together.

* 📝 docs: fix Logto callback path and AUTH_SECRET deprecation guidance

- Revert Logto/Sealos callback URLs to /api/auth/callback/logto to match
  the runtime SSO redirectURI override
- Narrow legacy auth Callout: AUTH_SECRET remains required for Better Auth;
  mark NEXT_AUTH_SECRET as deprecated in zh-CN

* 📝 docs: refresh agent skills for locales, env, auth, and agentRun paths

Align OSS agent guidance with post-refactor layout:
- packages/locales/src/default + bun run i18n
- packages/env/src for env schemas (@/envs alias)
- spa-auth shell + src/routes/auth segments
- chat agentRun/transports/hetero instead of aiChat

* 📝 docs: document APP_URL as required for Better Auth base URL

Self-hosted auth uses appEnv.APP_URL as baseURL, not request-header
auto-detection. NEXT_PUBLIC_AUTH_URL remains deprecated.

* 📝 docs: note self-host search provider setup for web search

Built-in lobe-web-browsing needs no client plugin, but self-hosted
servers still require SEARCH_PROVIDERS / SEARXNG_URL (default SearXNG).

* 📝 docs: point feature guide welcome UI at AgentHome

Opening message/questions on the agent chat page live in
src/features/AgentHome, not Onboarding WelcomeMessage.
2026-07-10 17:50:03 +08:00

71 lines
3.6 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 在 LobeHub 中配置 Github 身份验证服务
description: 学习如何在 LobeHub 中配置 Github 身份验证服务,包括创建新的 Github App、设置权限和环境变量。
tags:
- Github 身份验证
- Github App
- 环境变量配置
- 单点登录
- LobeHub
---
# 配置 Github 身份验证服务
<Callout type={'warning'}>
NextAuth(Auth.js)已从 LobeHub 中完全移除。下文出现的 `NEXT_AUTH_SSO_PROVIDERS` 和 `AUTH_URL` 等变量现在会导致部署在构建 / 启动阶段失败。本页仅作历史参考保留,请改用 [Better Auth 提供商指南](/zh/docs/self-hosting/auth) 和 [NextAuth 迁移至 Better Auth 指南](/zh/docs/self-hosting/migration/v2/auth/nextauth-to-betterauth)。
</Callout>
## Github 配置流程
<Steps>
### 创建 Github 提供应用
点击 [这里](https://github.com/settings/apps/new) 创建一个新的 Github App。
填写 Github App name、Homepage URL、Callbak URL
<Image alt="创建 Github 提供程序" inStep src="/blog/assets64475363/2f919f99-2aaa-4fa7-9938-169d3ed09db7.webp" />
按照自己所需设置 Webhook 回调地址
<Image alt="填写其他字段" inStep src="/blog/assets64475363/d7ef5ad1-b1a3-435e-b1bc-4436d2b6fecd.webp" />
设置读取邮件地址权限
<Image alt="设置所需权限" inStep src="/blog/assets64475363/23131ca1-9e84-4a89-a840-ef79c4bc0251.webp" />
<Image alt="设置读取邮件地址权限" inStep src="/blog/assets64475363/358bca8d-3d82-4e76-9a5e-90d16a39efde.webp" />
设置公开访问还是仅自己访问
<Image alt="设置公开访问还是仅自己访问" inStep src="/blog/assets64475363/995780cb-9096-4a36-ab17-d422703ab970.webp" />
点击「Create Github App」
创建成功后,点击「Generate a new client secret」创建客户端 Secret
<Image alt="创建新的客户端密钥" inStep src="/blog/assets64475363/6d69bdca-7d18-4cbc-b3e0-220d8815cd29.webp" />
创建成功后, 将 `客户端 ID` 和 `客户端 Secret` 保存下来。
<Image alt="创建新的客户端密钥" inStep src="/blog/assets64475363/c6108133-a918-48b0-ab1a-e3fa607572a4.webp" />
### 配置环境变量
在部署 LobeHub 时,你需要配置以下环境变量:
| 环境变量 | 类型 | 描述 |
| ------------------------- | -- | ------------------------------------------------------------------------------------------- |
| `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Github 请填写 `github`。 |
| `AUTH_GITHUB_ID` | 必选 | Github App 详情页的 客户端 ID |
| `AUTH_GITHUB_SECRET` | 必选 | Github App 详情页的 客户端 Secret |
| `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
<Callout type={'tip'}>
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#github) 可查阅相关变量详情。
</Callout>
</Steps>
<Callout type={'info'}>部署成功后,用户将可以通过 Github 身份认证并使用 LobeHub。</Callout>