Using the official doc or the guide from scotch.io, I could not fetch the e-mail address from facebook login. From this response on SO, I made the following changes:
/* does not work */ passport.use('facebookAuth',new facebookStrategy({ 'clientID' : CLIENT-ID, 'clientSecret' : CLIENT-SECRET, 'callbackURL' : '/auth/facebook/callback' function(accessToken, refreshToken, profile, done){ thirdpartylogin('facebook',profile,null,function(user){ return done(null,user); }) } ))
/* works */ passport.use('facebookAuth',new facebookStrategy({ 'clientID' : CLIENT-ID, 'clientSecret' : CLIENT-SECRET, 'callbackURL' : '/auth/facebook/callback', 'profileFields' : ['id', 'emails', 'name']}, function(accessToken, refreshToken, profile, done){ thirdpartylogin('facebook',profile,null,function(user){ return done(null,user); }) } ))
Lo and behold, problem solved. Thanks SO!
- Previous: How I solved
- Next: Bizarre behaviours of EJS + JS + git