passport authentication failure leads to redirect loop
I believe it is because you are using a custom callback and need to provide a res object like....
app.get('/facebook/auth/callback', function(req, res, next) { passport.authenticate('facebook',..............
Doing more research, because I also use passport.js to integrate with a facebook (and others), it looks like this might already be an open issue reported for the passport-oauth (which passport-facebook uses).
The person logging the problem had a workaround for the error check on line 98 of the oauth2 code :
app.get('/auth/facebook', passport.authenticate('facebook')); app.get('/auth/facebook/callback', , function(req, res, next) { if (req.query && !req.query.error && req.query.error_code) { req.query.error = true; } next(); } , passport.authenticate('facebook', { failureRedirect: '/auth-failure', successRedirect: '/auth-success' } );
For good measure, it's also a good idea to double-check your settings on Facebook and that your localhost is listed in the right location(s). Also, check to be sure that everything matches perfectly in Node.js. I had issues with passport-twitter when I made a typo in my configuration strings that was very hard to catch as it didn't throw an error in Node.js but caused my auth to fail in a difficult way to catch. Here are a few links with people who had the same error_message
as you and they seem to indicate facebook-side configuration issues: