Extend GitHub Oauth2 strategy for use with GitHub Enterprise #3568
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The GitHub Oauth2 SSO strategy is built on top of the passport-github2 package. That package, by default, is configured to use public GitHub as the identity provider:
Authorization URL Setting
Token URL Setting
User Profile URL Setting
User Email URL Setting
Those defaults can be overridden so that an instance of GitHub Enterprise can be used as the identity provider.
The purpose of this PR is to enable that by setting the following environment variables:
GITHUB_AUTHORIZATION_URL
: Authorization endpoint.GITHUB_TOKEN_URL
: Endpoint to retrieve access token.GITHUB_USER_PROFILE_URL
: Endpoint to retrieve general user info (e.g., full name).GITHUB_USER_EMAIL_URL
: Endpoint to retrieve user emails.Sample configuration:
The changes introduced in this PR are completed backwards compatible. As such, if if the intent is to use public GitHub as the identity provider, nothing changes. However, to use an instance of GitHub Enterprise as the identity provider, the environment variables outlined above must be set appropriately.
Checks