Skip to content Skip to sidebar Skip to footer

Page Callback Not Load With Nodejs Express Passport-facebook

I have an application node js using express for authentication via facebook but the url /auth/facebook/callback does not load. Dependencies version: Express: 4.13.3 Passport 0.3.0

Solution 1:

In routes/index.js in /auth/facebook/callback route you forgot about calling authenticate method with req, res, next arguments. That is why your application was stuck ('next' callback was never called).

var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

router.get('/auth/facebook', function(req, res, next){
    req.passport.authenticate('facebook')(req, res, next);
});

router.get('/auth/facebook/callback', function(req, res, next){
    req.passport.authenticate('facebook', {
        successRedirect: '/',
        failureRedirect: '/login' }
    )(req, res, next); // missing function call
});

module.exports = router;

Post a Comment for "Page Callback Not Load With Nodejs Express Passport-facebook"