fix add github link to passport

This commit is contained in:
Berkeley Martinez
2015-08-10 23:38:10 -07:00
parent 5f21db457d
commit 2256f3ef6e
3 changed files with 16 additions and 2 deletions

View File

@ -79,7 +79,7 @@ export default function(UserIdent) {
} }
// if user signed in with github refresh their info // if user signed in with github refresh their info
if (userIdent.provider === 'github-login') { if (/github/.test(userIdent.provider)) {
debug("user isn't github cool or username from github is different"); debug("user isn't github cool or username from github is different");
setProfileFromGithub(user, profile, profile._json); setProfileFromGithub(user, profile, profile._json);
userChanged = true; userChanged = true;

View File

@ -141,5 +141,19 @@ module.exports = {
clientSecret: process.env.GITHUB_SECRET, clientSecret: process.env.GITHUB_SECRET,
scope: ['email'], scope: ['email'],
failureFlash: true failureFlash: true
},
'github-link': {
provider: 'github',
authScheme: 'oauth2',
module: 'passport-github',
authPath: '/link/github',
callbackURL: '/link/github/callback',
callbackPath: '/link/github/callback',
successRedirect: successRedirect,
failureRedirect: failureRedirect,
clientID: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
scope: ['email'],
failureFlash: true
} }
}; };

View File

@ -102,7 +102,7 @@ var passportOptions = {
userObj.email = email; userObj.email = email;
} }
if (provider === 'github-login') { if (/github/.test(provider)) {
setProfileFromGithub(userObj, profile, profile._json); setProfileFromGithub(userObj, profile, profile._json);
} }
return userObj; return userObj;