Can't Get Response.email from facebook API v2.5 even email is green in App Reviews. I used this basic FB.api(), even with SCOPE it doesn't return EMAIL
FB.api('/me', function(response) {
console.log(response);
});
Can't Get Response.email from facebook API v2.5 even email is green in App Reviews. I used this basic FB.api(), even with SCOPE it doesn't return EMAIL
FB.api('/me', function(response) {
console.log(response);
});
The proper way to ask for additional fields (other than id and name) is this one:
FB.api('/me', {fields: 'email'}, function(response) {
console.log(response);
});
Of course, make sure you have added the email
permission in the scope:
FB.login(function(response) {
if (response.authResponse) {
}
}, {scope: 'email'});
Additional information.
Btw, you can test API calls here.
First of all make sure that FB.login()
is called with scope: email
so that the token will have the permission to access the user's email.
Then, you should mention the field email
explicitly while calling /me
since by default it will return id
and name
only.
FB.api('/me?fields=email', function(response) {
console.log(response);
});
Make sure you define "email" scope while login, then you could get it when you ask graph.facebook.com:
$url = 'https://www.facebook.com/dialog/oauth';
$params = array(
'client_id' => $this->strategy['app_id'],
'redirect_uri' => $this->strategy['redirect_uri'],
'scope' => 'email',
);
mybad, nothing is wrong with the code, I just did a reset with the permissions on the app.