Error handling bug
Bogdaan opened this issue · comments
When user cancel auth request - server throw 5xx errors.
By design - it must redirected to failureRedirect.
See jaredhanson/passport-facebook#93
Worked example:
router.get('/auth/vk/callback',
passport.authenticate('vk', { failureRedirect : '/login-failed'}),
// on succes
function(req,res) {
// setup succes message
// .......
},
// on error
function(err,req,res,next) {
res.redirect('/login-failed');
}
);
UPD for new version of passportjs see:
https://github.com/jaredhanson/passport/blob/master/lib/middleware/authenticate.js#L24