Passport Authentication Callback Hangs
After hours trying to solve this by myself I reach to SO community looking for some light. I'm using passport for user authentication. It's already initialized in my main express.j
Solution 1:
If you're a noob to passport/express like me, this may help:
check if you invoke done() in your passport logic:
passport.use(new twitchStrategy({
clientID: config.twitchID,
clientSecret: config.twitchSecret,
/*to be updated*/
callbackURL: config.callbackURL,
scope: "user_read"
},
function(accessToken, refreshToken, profile, done) {
console.log(profile);
***return done();***
}
));
Solution 2:
I see a few possible missing pieces glancing at my code. Are you using the passport.session()
middleware? Also the serializeUser
and deserializeUser
functions?
passport.serializeUser(function(user, done) {
//place user's id in cookie
done(null, user.id);
});
passport.deserializeUser(function(id, done) {
//retrieve user from database by id
User.findById(id, function(err, user) {
done(err, user);
});
});
Post a Comment for "Passport Authentication Callback Hangs"