lobehub/docs/self-hosting/auth/providers/auth0.mdx
Arvin Xu adbf11dc11
📝 docs: update documents (#12982)
update document
2026-03-14 22:06:09 +08:00

111 lines
4.2 KiB
Text

---
title: Configuring Auth0 Authentication for LobeHub
description: >-
Learn how to configure Auth0 SSO for LobeHub, including creating applications,
adding users, and setting up environment variables.
tags:
- Auth0
- Authentication
- LobeHub
- Single Sign-On
---
# Configuring Auth0 Authentication
<Steps>
### Create Auth0 Application
1. Go to [Auth0 Dashboard](https://manage.auth0.com/dashboard)
2. Click **Applications** > **Create Application**
<Image alt="Create Auth0 Application S1" inStep src="https://github.com/lobehub/lobehub/assets/30863298/f068190f-0027-4d3b-8667-d632e43d5a86" />
3. Fill in the application name
4. Select **Regular Web Applications** as the application type
5. Click **Create**
<Image alt="Create Auth0 Application S2" inStep src="https://github.com/lobehub/lobehub/assets/30863298/3e0082df-9b6f-46f3-b67f-bdc79e1eb2cc" />
### Configure Application Settings
After creation, go to the **Settings** tab:
<Image alt="Create Auth0 Application S3" inStep src="https://github.com/lobehub/lobehub/assets/30863298/df4cea85-616a-46f5-b2de-42725d9b82a6" />
Note down:
- **Domain** (e.g., `your-tenant.auth0.com`)
- **Client ID**
- **Client Secret**
### Configure Callback URL
In **Allowed Callback URLs**, add:
<Callout type={'info'}>
Callback URL format:
- Local development: `http://localhost:3210/api/auth/callback/auth0`
- Production: `https://your-domain.com/api/auth/callback/auth0`
</Callout>
<Image alt="Create Auth0 Application S4" inStep src="https://github.com/lobehub/lobehub/assets/30863298/62fbd09f-a69a-4460-949b-0f6285fa65b9" />
### Add Users (Optional)
Click **User Management** to create users for your organization.
<Image alt="Add Users" inStep src="https://github.com/lobehub/lobehub/assets/30863298/0beda150-d0b6-43cf-a9f1-fce928b83a96" />
### Configure Environment Variables
| Environment Variable | Type | Description |
| -------------------- | -------- | --------------------------------------------------------------- |
| `AUTH_SECRET` | Required | Session encryption key, generate with `openssl rand -base64 32` |
| `AUTH_SSO_PROVIDERS` | Required | Set to `auth0` |
| `AUTH_AUTH0_ID` | Required | Client ID |
| `AUTH_AUTH0_SECRET` | Required | Client Secret |
| `AUTH_AUTH0_ISSUER` | Required | `https://your-tenant.auth0.com` |
<Callout type={'tip'}>
Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#auth0)
for detailed information.
</Callout>
</Steps>
<Callout type={'info'}>
After successful deployment, users will be able to authenticate with Auth0 and
use LobeHub.
</Callout>
## Advanced Configuration
### Connect Existing SSO Services
If your organization has existing identity infrastructure, connect to SSO services in **Applications** > **SSO Integrations**.
Auth0 supports Azure AD, Slack, Google Workspace, Office 365, Zoom, and more. See [Auth0 SSO Integrations](https://marketplace.auth0.com/features/sso-integrations).
<Image alt="Connecting to Existing SSO Service" src="https://github.com/lobehub/lobehub/assets/30863298/9891347e-a338-4aa9-8714-f16c8dbcfcec" />
### Configure Social Login
Configure social login in **Authentication** > **Social**.
<Image alt="Configuring Social Login" src="https://github.com/lobehub/lobehub/assets/30863298/880749a6-5ba4-4e20-a968-b583a54de7fa" />
<Callout type={'warning'}>
Social login by default allows anyone to authenticate. Configure blocking
policies to restrict access.
</Callout>
<Callout type={'warning'}>
When creating a GitHub connection, make sure to enable the **Email Address** permission in the **Attributes** section. LobeHub requires user email for authentication.
<Image alt="GitHub Connection Email Permission" src="https://hub-apac-1.lobeobjects.space/docs/afdf22891dda3e5e44c690db184c548e.png" />
</Callout>
## Related Resources
- [Auth0 Dashboard](https://manage.auth0.com/dashboard)
- [Auth0 Documentation](https://auth0.com/docs)