Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to configure GitHub Enterprise #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,29 @@ passport.use(new GitHubStrategy({
));
```


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
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
Expand Down