Permalink
Browse files

Merge pull request #5 from rragan/corpGitHub

Add support for auth with Corporate GitHubs
  • Loading branch information...
2 parents ebb8248 + 6772094 commit d4d936f23a2d1a50e9d9df8726e6a610c5463d55 @jaredhanson committed Apr 10, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/passport-github/strategy.js
@@ -49,6 +49,7 @@ function Strategy(options, verify) {
options.tokenURL = options.tokenURL || 'https://github.com/login/oauth/access_token';
options.scopeSeparator = options.scopeSeparator || ',';
+ this.userProfileURL = options.userProfileURL || 'https://api.github.com/user';
OAuth2Strategy.call(this, options, verify);
this.name = 'github';
}
@@ -76,7 +77,8 @@ util.inherits(Strategy, OAuth2Strategy);
* @api protected
*/
Strategy.prototype.userProfile = function(accessToken, done) {
- this._oauth2.get('https://api.github.com/user', accessToken, function (err, body, res) {
+ var url = this.userProfileURL;
+ this._oauth2.get(url, accessToken, function (err, body, res) {
if (err) { return done(new InternalOAuthError('failed to fetch user profile', err)); }
try {

0 comments on commit d4d936f

Please sign in to comment.