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

Prerequisites

  • A GitHub 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
  2. Click OAuth Apps > New OAuth App
  3. Enter an Application name (e.g. “Prelude Session”)
  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 (e.g. session.yourapp.com).
  1. Click Register application
  2. Copy the Client ID
  3. Click Generate a new client secret and copy the Client Secret
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

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
    }
  }'
FieldDescription
client_idYour GitHub OAuth client ID.
client_secretYour GitHub OAuth client secret.
enabledSet to true to enable GitHub login.
options.use_email_as_identifierWhen true, the user’s GitHub email is stored as an email identifier.
options.allow_email_account_mergeWhen 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:
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:
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 guide.