node.js - How to get profile data from facebook using passport.js authentication? -
in below code 'console.log('this not print!')' statement not execute. should execute according facebookstrategy.
passport.use( new facebookstrategy({clientid: facebook_app_id, clientsecret: facebook_app_secret, callbackurl: "/home"}, function(identifier, profile, done) { process.nexttick(function () { console.log(' not print!'); return done(null, profile); } );}));
basically, authentication thru passport-facebook takes place not able recover profile data.
app.get('/home', function(req, res){ console.log(req.user); res.render('home', {user: req.user}); });
the above prints 'undefined' means above app.get(...) did not receive facebook profile data.
what doing wrong? there anyway save (get) facebook profile data after authentication?
above
callbackurl: "/home"
is wrongly declared. should be:
callbackurl: "/auth/facebook/callback"
for more on discussion https://github.com/jaredhanson/passport-facebook/issues/47
Comments
Post a Comment