fix add github link to passport
This commit is contained in:
@ -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;
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -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;
|
||||||
|
Reference in New Issue
Block a user