Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
with
24 additions
and
0 deletions.
-
+24
−0
README.md
|
@@ -57,6 +57,30 @@ passport.use(new GitHubStrategy({ |
|
|
)); |
|
|
``` |
|
|
|
|
|
#### Enterprise (Corporate) GitHub |
|
|
|
|
|
To make it work with Enterprise GitHub instances you need to |
|
|
pass in 3 additional parameters: `authorizationURL`, `tokenURL`, and `userProfileURL`. |
|
|
|
|
|
```js |
|
|
var GitHubStrategy = require('passport-github').Strategy; |
|
|
|
|
|
passport.use(new GitHubStrategy({ |
|
|
clientID: GITHUB_CLIENT_ID, |
|
|
clientSecret: GITHUB_CLIENT_SECRET, |
|
|
authorizationURL: "https://ENTERPRISE_INSTANCE_URL/login/oauth/authorize", |
|
|
tokenURL: "https://ENTERPRISE_INSTANCE_URL/login/oauth/access_token", |
|
|
userProfileURL: "https://ENTERPRISE_INSTANCE_URL/api/v3/user", |
|
|
callbackURL: "http://127.0.0.1:3000/auth/github/callback" |
|
|
}, |
|
|
function(accessToken, refreshToken, profile, cb) { |
|
|
User.findOrCreate({ githubId: profile.id }, function (err, user) { |
|
|
return cb(err, user); |
|
|
}); |
|
|
} |
|
|
)); |
|
|
``` |
|
|
|
|
|
#### Authenticate Requests |
|
|
|
|
|
Use `passport.authenticate()`, specifying the `'github'` strategy, to |
|
|