docs/self-hosting/auth/providers/github.mdx
<Callout type={'info'}> Callback URL format:
- Local development: `http://localhost:3210/api/auth/callback/github`
- Production: `https://your-domain.com/api/auth/callback/github`
Set the Webhook URL according to your needs (can be disabled if not used).
<Image alt="Fill in other fields" inStep src="https://github.com/lobehub/lobehub/assets/64475363/d7ef5ad1-b1a3-435e-b1bc-4436d2b6fecd" />Set permission to read user email addresses:
<Image alt="Set required permissions" inStep src="https://github.com/lobehub/lobehub/assets/64475363/23131ca1-9e84-4a89-a840-ef79c4bc0251" /> <Image alt="Set permission to read email addresses" inStep src="https://github.com/lobehub/lobehub/assets/64475363/358bca8d-3d82-4e76-9a5e-90d16a39efde" />Set whether the app is publicly accessible or only accessible to yourself.
<Image alt="Set accessibility" inStep src="https://github.com/lobehub/lobehub/assets/64475363/995780cb-9096-4a36-ab17-d422703ab970" />Click Create GitHub App.
After creation, click Generate a new client secret.
<Image alt="Create a new client secret" inStep src="https://github.com/lobehub/lobehub/assets/64475363/6d69bdca-7d18-4cbc-b3e0-220d8815cd29" />Save the Client ID and Client Secret.
<Image alt="Save credentials" inStep src="https://github.com/lobehub/lobehub/assets/64475363/c6108133-a918-48b0-ab1a-e3fa607572a4" />| Environment Variable | Type | Description |
|---|---|---|
AUTH_SECRET | Required | Session encryption key, generate with openssl rand -base64 32 |
AUTH_SSO_PROVIDERS | Required | Set to github |
AUTH_GITHUB_ID | Required | Client ID from the GitHub App |
AUTH_GITHUB_SECRET | Required | Client Secret from the GitHub App |
<Callout type={'tip'}> Go to 📘 Environment Variables for detailed information. </Callout> </Steps>
<Callout type={'info'}> After successful deployment, users will be able to authenticate with GitHub and use LobeHub. </Callout>
This usually happens when the GitHub App doesn't have email read permission. Go to your app settings, navigate to Permissions & events > Account permissions > Email addresses and set it to Read-only.
GitHub OAuth does not issue refresh tokens. Access tokens remain valid until the user revokes access, the app revokes access, or the token hasn't been used for one year.