The GitHub integration allows your AI Agents to authenticate users with their GitHub accounts and access GitHub repositories and manage issues their behalf.

Overview

The GitHub integration is perfect for developer focused AI applications that need to interact with code repositories, manage issues, or automate development workflows. This integration provides access to both public and private repositories based on user permissions.

Configuration

GitHub apps use fine grained permissions and hence requesting permissions when configuring Token Vault is not supported. Instead, you should set the required permissions when creating the GitHub app in the GitHub developer settings.
1

Set up app in Github

  1. Sign up for a GitHub Developer account
  2. Set up a new GitHub app via GitHub Developer Settings > GitHub Apps
  3. Use the following settings when configuring your GitHub app:
    • Homepage URL: https://YOUR_AUTH0_DOMAIN
    • Callback URL: https://YOUR_AUTH0_DOMAIN/login/callback
    • Webhook Active: Disabled
    • Permissions: Select the appropriate permissions for your app
    You can find the Auth0 domain in the Auth0 Dashboard.You can find this under Applications > [Your Application] > Settings > Basic Information > Domain.If you are using the custom domains feature, your Auth0 domain is the custom domain. You can find this under Branding > Custom Domains.
  4. Create the app and generate a new client secret in the app settings page that appears.
  5. Note your Client ID and Client Secret
2

Configure the GitHub Social Connection in Auth0

  1. In the Auth0 Dashboard, navigate to Authentication > Social. Select Create Connection and then GitHub. Click Continue.
  2. In General, enter the Client ID and Client Secret from the GitHub OAuth app you created.
  3. In Advanced, toggle Enable Token Vault. This allows the connection to retrieve and store access tokens for third-party APIs securely. To learn more, read Configure Token Vault.
  4. Click Create.
  5. After saving, go the Applications tab and select the applications that should use this connection.

Token Vault configuration Example

To configure the Token Vault for your GitHub connection, you can use the following code snippet in your application:
const auth0AI = new Auth0AI();

export const withGitHubConnection = auth0AI.withTokenForConnection({
  connection: "github",
  // scopes are not supported for GitHub yet. Set required scopes when creating the accompanying GitHub app
  scopes: [],
  refreshToken: getAuth0RefreshToken(),
});

Account linking

If you want to use more than one connection for a user, you can link their accounts. This allows the user to log in with any of their linked accounts and have a single user profile in your application. This allows calling APIs from different providers with a single user profile. Learn more about Client-initiated account linking.

Learn more