---
title: Configuring Github Authentication Service for LobeChat
description: >-
Learn how to configure Github authentication service for LobeChat, including
creating a Github provider, setting up environment variables, and deploying
LobeChat.
tags:
- Github authentication
- LobeChat
- Environment variables
- Single Sign-On
- OAuth authentication
---
# Configuring Github Authentication Service
## Github Configuration Process
### 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.
Set the webhook callback URL according to your needs.
Set the permission to read email addresses.
Set whether it is accessible publicly or only accessible to yourself.
Click "Create Github App".
After successful creation, click "Generate a new client secret" to create a client secret.
After successful creation, save the `Client ID` and `Client Secret`.
### Configure Environment Variables
When deploying LobeChat, you need to configure the following environment variables:
| Environment Variable | Type | Description |
| --- | --- | --- |
| `NEXT_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 LobeChat. 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. |
| `NEXTAUTH_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` |
Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#github) for detailed
information on these variables.
After successful deployment, users will be able to authenticate with Github and use LobeChat.
[github-create-app]: https://github.com/settings/apps/new