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

# GitHub

> Connect your AI Agents to GitHub for repository access, issue management, and developer workflows.

Connect your AI Agents to GitHub for repository access, issue management, and developer workflows.

## Connect GitHub to Auth0

**GitHub app permissions:** GitHub apps [use fine grained permissions](https://docs.github.com/en/enterprise-server@3.17/apps/oauth-apps/building-oauth-apps/differences-between-github-apps-and-oauth-apps#requesting-permission-levels-for-resources) 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. GitHub setup**

<ol>
  <li>
    Sign up for a [GitHub Developer account](https://github.com/signup)
  </li>

  <li>
    Set up a new GitHub app via [GitHub Developer Settings > GitHub
    Apps](https://github.com/settings/apps/new)
  </li>

  <li>
    Use the following settings when configuring your GitHub app:

    <ul>
      <li>**Homepage URL**: `https://YOUR_AUTH0_DOMAIN`</li>
      <li>**Callback URL**: `https://YOUR_AUTH0_DOMAIN/login/callback`</li>
      <li>**Webhook Active**: Disabled</li>
      <li>**Permissions**: Select the appropriate permissions for your app</li>
    </ul>

    You can find the **Auth0 domain** in the [Auth0 Dashboard](https://manage.auth0.com/).

    You can find this under **Applications > \[Your Application] > Settings > Basic Information > Domain**.

    If you are using the [custom domains](https://auth0.com/docs/customize/custom-domains.md) feature, your Auth0 domain is the custom domain. You can find this under **Branding > Custom Domains**.
  </li>

  <li>
    Select **Create** and generate a new client secret in the **App settings** page
    that appears.
  </li>

  <li>Note your **Client ID** and **Client Secret**</li>
</ol>

**2. Auth0 setup**

<ol>
  <li>
    In the [Auth0 Dashboard](https://manage.auth0.com/), navigate to
    **Authentication > Social**. Select **Create Connection** and then
    **GitHub**. Select **Continue**.
  </li>

  <li>
    In **General**, enter the **Client ID** and **Client Secret** from the
    GitHub OAuth app you created.
  </li>

  <li>
    In **Purpose**, toggle on **Connected Accounts for Token Vault**. This allows the
    connection to retrieve and securely store access tokens for external APIs. To learn more, read [Connected Accounts for Token
    Vault](https://auth0.com/docs/secure/call-apis-on-users-behalf/token-vault/connected-accounts-for-token-vault.md).
  </li>

  <li>Select **Create**.</li>

  <li>
    After saving, go to the **Applications** tab and select the applications
    that should use this connection.
  </li>
</ol>

If your application uses [Organizations](https://auth0.com/docs/manage-users/organizations.md), authenticate the user with the target organization before initiating the Connected Accounts flow. Token Vault still stores the GitHub connected account on the user's Auth0 profile, so each organization member authorizes their own GitHub account.

This guide walks you through setting up the **GitHub** connection in Auth0.
For an end-to-end example that shows how to set up your app to call third-party APIs on the user's behalf
using a connection like this, read the
[Call third-party APIs on user's behalf quickstart](https://auth0.com/ai/docs/get-started/call-third-party-apis-on-users-behalf.md).

## Token Vault configuration example

To configure the Token Vault for your GitHub connection, you can use the following code snippet in your application:

**JavaScript**

```tsx wrap lines theme={null}
const auth0AI = new Auth0AI();

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

**Python**

```python wrap lines theme={null}
auth0_ai = Auth0AI()

with_github_connection = auth0_ai.with_token_vault(
    connection="github",
    # scopes are not supported for GitHub yet. Set required scopes when creating the accompanying GitHub app
    scopes=[],
    refresh_token=get_auth0_refresh_token,
)
```

## Next steps

* To learn how to configure applications to access Token Vault, read [Configure Token Vault](https://auth0.com/docs/secure/call-apis-on-users-behalf/token-vault/configure-token-vault.md).
* If your application uses [Organizations](https://auth0.com/docs/manage-users/organizations.md), authenticate the user with the target organization before initiating the Connected Accounts flow. Connected accounts remain linked to the individual user profile.
* To learn how to get an access token to make a tool call, complete the [Call third-party APIs on user's behalf Quickstart](https://auth0.com/ai/docs/get-started/call-third-party-apis-on-users-behalf.md).
