> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prelude.so/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub

> Configure GitHub OAuth for your Auth application.

This guide walks you through configuring GitHub as a social login provider for your application.

## Prerequisites

* A [GitHub](https://github.com/) account
* Your GitHub OAuth **Client ID** and **Client Secret**

## Configure GitHub OAuth

**1. Create an OAuth App on GitHub**

1. Go to [GitHub Developer Settings](https://github.com/settings/developers)
2. Click **OAuth Apps** > **New OAuth App**
3. Enter an **Application name** (e.g. "Prelude Auth")
4. Enter the **Homepage URL** of your application
5. Set the **Authorization callback URL** to:

```
https://${YOUR_CUSTOM_DOMAIN}/v1/session/login/oauth/github/callback
```

Replace `${YOUR_CUSTOM_DOMAIN}` with your [custom domain](https://docs.prelude.so/session/documentation/domain-names.md) (e.g. `session.yourapp.com`).

6. Click **Register application**
7. Copy the **Client ID**
8. Click **Generate a new client secret** and copy the **Client Secret**

> [!NOTE]
>
> The callback URL must match exactly. Make sure there is no trailing slash and that you are using `https`.

**2. Create the GitHub OAuth configuration**

```bash theme={null}
curl -X POST https://api.prelude.dev/v2/session/apps/${APP_ID}/config/login/oauth/github \
  -H "Authorization: Bearer ${MANAGEMENT_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "your-github-client-id",
    "client_secret": "your-github-client-secret",
    "enabled": true,
    "options": {
      "use_email_as_identifier": true,
      "allow_email_account_merge": true
    }
  }'
```

| Field | Description |
| - | - |
| `client_id` | Your GitHub OAuth client ID. |
| `client_secret` | Your GitHub OAuth client secret. |
| `enabled` | Set to `true` to enable GitHub login. |
| `options.use_email_as_identifier` | When `true`, the user's GitHub email is stored as an email identifier. |
| `options.allow_email_account_merge` | When `true`, if a user with the same email already exists, the GitHub account is linked to the existing user. |

## Update the configuration

To update an existing GitHub OAuth configuration:

```bash theme={null}
curl -X PUT https://api.prelude.dev/v2/session/apps/${APP_ID}/config/login/oauth/github \
  -H "Authorization: Bearer ${MANAGEMENT_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "your-new-github-client-id",
    "client_secret": "your-new-github-client-secret",
    "enabled": true,
    "options": {
      "use_email_as_identifier": true,
      "allow_email_account_merge": true
    }
  }'
```

## Delete the configuration

To remove GitHub OAuth from your application:

```bash theme={null}
curl -X DELETE https://api.prelude.dev/v2/session/apps/${APP_ID}/config/login/oauth/github \
  -H "Authorization: Bearer ${MANAGEMENT_API_KEY}"
```

## What's next?

Now that GitHub OAuth is configured on your backend, integrate the frontend using the [Web Integration](https://docs.prelude.so/session/documentation/frontend-sdks/web/social-login.md) guide.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.