4

In the below code the 'console.log('this does not print!')' statement does not execute. It should execute according to the FacebookStrategy.

passport.use( new FacebookStrategy({clientID: FACEBOOK_APP_ID, clientSecret: FACEBOOK_APP_SECRET, callbackURL: "/home"}, function(identifier, profile, done) {

process.nextTick(function () {
  console.log(' This does not print!');
  return done(null, profile);
  }
);}));

Basically, the authentication thru passport-facebook takes place but I am not able to recover any profile data.

app.get('/home', function(req, res){
    console.log(req.user);
    res.render('home', {user: req.user});
});

The above prints 'undefined' which means that the above app.get(...) did not receive the facebook profile data.

What am I doing wrong? Is there anyway to save (get) facebook profile data after authentication?

1 Answer 1

3

Above

callbackURL: "/home"

is wrongly declared. It should be:

callbackURL: "/auth/facebook/callback"

for more on this discussion https://github.com/jaredhanson/passport-facebook/issues/47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.