<a id="github-enterprise"></a>

<a id="backend-classes"></a>

# Backend classes

For Django, choose from these class paths for `AUTHENTICATION_BACKENDS`.
For other integrations, use the same class paths in the
framework-specific backend setting.

| Backend name             | Class path                                                                  |
|--------------------------|-----------------------------------------------------------------------------|
| `github-enterprise`      | `social_core.backends.github_enterprise.GithubEnterpriseOAuth2`             |
| `github-enterprise-org`  | `social_core.backends.github_enterprise.GithubEnterpriseOrganizationOAuth2` |
| `github-enterprise-team` | `social_core.backends.github_enterprise.GithubEnterpriseTeamOAuth2`         |

<a id="id1"></a>

## GitHub Enterprise

GitHub Enterprise works similar to regular GitHub, which is in turn based on Facebook (OAuth).

- Register a new application on your instance of [GitHub Enterprise Developers](https://<your_github_enterprise_domain>/settings/applications/new),
  set the callback URL to `http://example.com/complete/github-enterprise/` replacing `example.com`
  with your domain.
- Set the URL for your GitHub Enterprise appliance:
  > SOCIAL_AUTH_GITHUB_ENTERPRISE_URL = ‘[https://git.example.com/](https://git.example.com/)’
- Set the API URL for your GitHub Enterprise appliance:
  > SOCIAL_AUTH_GITHUB_ENTERPRISE_API_URL = ‘[https://git.example.com/api/v3/](https://git.example.com/api/v3/)’
- Fill the `Client ID` and `Client Secret` values from GitHub in the settings:
  > SOCIAL_AUTH_GITHUB_ENTERPRISE_KEY = ‘Client_ID’
  > SOCIAL_AUTH_GITHUB_ENTERPRISE_SECRET = ‘Client_Secret’
- Also it’s possible to define extra permissions with:
  ```default
  SOCIAL_AUTH_GITHUB_ENTERPRISE_SCOPE = [...]
  ```

<a id="github-enterprise-for-organizations"></a>

# GitHub Enterprise for Organizations

When defining authentication for organizations, use the
`GithubEnterpriseOrganizationOAuth2` backend instead. The settings are the same as
the non-organization backend, but the names must be:

```default
SOCIAL_AUTH_GITHUB_ENTERPRISE_ORG_*
```

Be sure to define the organization name using the setting:

```default
SOCIAL_AUTH_GITHUB_ENTERPRISE_ORG_NAME = ''
```

This name will be used to check that the user really belongs to the given
organization and discard it if they’re not part of it.

<a id="github-enterprise-for-teams"></a>

# GitHub Enterprise for Teams

Similar to `GitHub Enterprise for Organizations`, there’s a GitHub for Teams backend,
use the backend `GithubEnterpriseTeamOAuth2`. The settings are the same as
the basic backend, but the names must be:

```default
SOCIAL_AUTH_GITHUB_ENTERPRISE_TEAM_*
```

Be sure to define the `Team ID` using the setting:

```default
SOCIAL_AUTH_GITHUB_ENTERPRISE_TEAM_ID = ''
```

This `id` will be used to check that the user really belongs to the given
team and discard it if they’re not part of it.
