Passport-facebook doesn't get email [duplicate] Passport-facebook doesn't get email [duplicate] express express

Passport-facebook doesn't get email [duplicate]


I had the same problem. We had 10 test users, all 10 had email addresses associated with their Facebook account. But for one of the 10 testers, Facebook did not return the 'email' JSON property in the profile response. I have no idea why, since it looked identical to other Facebook profiles that worked fine.

The fix was to change this line:

passport.authenticate('facebook')

To this:

passport.authenticate('facebook', { scope: [ 'email' ] })

I still can't explain why it worked for 9/10, but not for one. Either way, it's fixed now :-)


Try this passport.authenticate('facebook', { scope: [ 'email' ] })

Also add a new field profileFields: [ 'email' , 'name' ] in the facebookStrategy


  passport.use(new FacebookStrategy({    clientID: config.facebook.clientID,    clientSecret: config.facebook.clientSecret,    callbackURL: config.facebook.callbackURL,    passReqToCallback:true  },