From 5283b9c1a4a7d0efaa74ba3809d19218ef0d7e85 Mon Sep 17 00:00:00 2001 From: Joe Nathan Abellard Date: Sun, 19 Nov 2023 23:04:19 -0500 Subject: [PATCH 1/2] Document how to configure GitHub Enterprise --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 33cf455..719422f 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,29 @@ passport.use(new GitHubStrategy({ )); ``` + +By default, Public GiHub is used as the OAuth provider. However, an instance of GitHub Enterprise can also be used as the provider. +To configure that, provide the relevant endpoints to that server as follows: + +```javascript +passport.use(new GitHubStrategy({ + clientID: GITHUB_CLIENT_ID, + clientSecret: GITHUB_CLIENT_SECRET, + authorizationURL: `https://${ENTERPRISE_INSTANCE_HOST_NAME}/login/oauth/authorize`, + tokenURL: `https://${ENTERPRISE_INSTANCE_HOST_NAME}/login/oauth/access_token`, + userProfileURL: `https://${ENTERPRISE_INSTANCE_HOST_NAME}/api/v3/user`, + userEmailURL: `https://${ENTERPRISE_INSTANCE_HOST_NAME}/api/v3/user/emails`, + callbackURL: "http://127.0.0.1:3000/auth/github/callback" + }, + function(accessToken, refreshToken, profile, done) { + User.findOrCreate({ githubId: profile.id }, function (err, user) { + return done(err, user); + }); + } +)); +``` + + #### Authenticate Requests Use `passport.authenticate()`, specifying the `'github'` strategy, to From 25137bc1fb747f9dcab10f9bb5663d3a261dcb36 Mon Sep 17 00:00:00 2001 From: Joe Nathan Abellard Date: Sun, 19 Nov 2023 23:11:37 -0500 Subject: [PATCH 2/2] Document how to configure GitHub Enterprise --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 719422f..9a3aba3 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ passport.use(new GitHubStrategy({ ``` -By default, Public GiHub is used as the OAuth provider. However, an instance of GitHub Enterprise can also be used as the provider. +By default, Public GitHub is used as the OAuth provider. However, an instance of GitHub Enterprise can also be used as the provider. To configure that, provide the relevant endpoints to that server as follows: ```javascript