Facebook oauth login not returning email

7.7k views Asked by At

I am using this plugin for oauth login, here is my FB response while doing aouth login:

{"state":"","access_token":"XYZ","expires_in":5110943,"client_id":"CLIENT ID","network":"facebook","display":"popup","redirect_uri":"http://localhost/XYZ123/www/callback.html","scope":"email,basic","expires":1439628780.389}}

The problem is i am not getting email of user. As per other SO solutions :

I have verified email so that should not be a matter. I am not getting FB message regrading verifying email.

Here is output of CLIENT ID/permissions

{
  "data": [
    {
      "permission": "email", 
      "status": "granted"
    }, 
    {
      "permission": "public_profile", 
      "status": "granted"
    }
  ]
}
2

There are 2 answers

0
user237462 On

email

Provides access to the person's primary email address via the email property on the user object.

Do not spam users. Your use of email must comply with both Facebook policies and with the CAN-SPAM Act.

Note, even if you request the email permission it is not guaranteed you will get an email address. For example, if someone signed up for Facebook with a phone number instead of an email address, the email field may be empty.

Review Your app may use this permission without review from Facebook.

0
Drew On

You need to make an API call to get the users profile. Email is not included in the authResponse object.

var fb = hello('facebook');
fb.login({scope:'email'}).then(function(){
   return fb.api('me');
}).then(function(res){
   // do something with res.email
}, console.error.bind(console) );