Files
lobehub__lobehub/docs/self-hosting/auth/next-auth/github.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

79 lines
4.4 KiB
Plaintext

---
title: Configuring Github Authentication Service for LobeHub
description: >-
Learn how to configure Github authentication service for LobeHub, including
creating a Github provider, setting up environment variables, and deploying
LobeHub.
tags:
- Github authentication
- LobeHub
- Environment variables
- Single Sign-On
- OAuth authentication
---
# Configuring Github Authentication Service
<Callout type={'warning'}>
NextAuth (Auth.js) has been fully removed from LobeHub. The `NEXT_AUTH_SSO_PROVIDERS` and `AUTH_URL` variables shown below will now cause the deployment to fail at build/startup. This page is kept for historical reference only — use the [Better Auth provider guides](/docs/self-hosting/auth) and the [NextAuth to Better Auth migration guide](/docs/self-hosting/migration/v2/auth/nextauth-to-betterauth) instead.
</Callout>
## Github Configuration Process
<Steps>
### Create a Github Provider
Click [here][github-create-app] to create a new Github App.
Fill in the Github App name, Homepage URL, and Callback URL.
<Image alt="Create a Github Provider" inStep src="/blog/assets64475363/2f919f99-2aaa-4fa7-9938-169d3ed09db7.webp" />
Set the webhook callback URL according to your needs.
<Image alt="Fill in other fields" inStep src="/blog/assets64475363/d7ef5ad1-b1a3-435e-b1bc-4436d2b6fecd.webp" />
Set the permission to read email addresses.
<Image alt="Set required permissions" inStep src="/blog/assets64475363/23131ca1-9e84-4a89-a840-ef79c4bc0251.webp" />
<Image alt="Set permission to read email addresses" inStep src="/blog/assets64475363/358bca8d-3d82-4e76-9a5e-90d16a39efde.webp" />
Set whether it is accessible publicly or only accessible to yourself.
<Image alt="Set whether it is accessible publicly or only accessible to yourself" inStep src="/blog/assets64475363/995780cb-9096-4a36-ab17-d422703ab970.webp" />
Click "Create Github App".
After successful creation, click "Generate a new client secret" to create a client secret.
<Image alt="Create a new client secret" inStep src="/blog/assets64475363/6d69bdca-7d18-4cbc-b3e0-220d8815cd29.webp" />
After successful creation, save the `Client ID` and `Client Secret`.
<Image alt="Create a new client secret" inStep src="/blog/assets64475363/c6108133-a918-48b0-ab1a-e3fa607572a4.webp" />
### Configure Environment Variables
When deploying LobeHub, you need to configure the following environment variables:
| Environment Variable | Type | Description |
| ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the Single Sign-On provider for LobeHub. Use `github` for Github. |
| `AUTH_GITHUB_ID` | Required | Client ID in the Github App details page. |
| `AUTH_GITHUB_SECRET` | Required | Client Secret in the Github App details page. |
| `AUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. Only set it if the default generated redirect address is incorrect. `https://example.com/api/auth` |
<Callout type={'tip'}>
Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#github) for detailed
information on these variables.
</Callout>
</Steps>
<Callout type={'info'}>
After successful deployment, users will be able to authenticate with Github and use LobeHub.
</Callout>
[github-create-app]: https://github.com/settings/apps/new