I am trying to return user email address using facebook api. Few days ago it was working fine, but today stopped working, and don't know why.
So first I get access token:
FB.login(response => {
if (response.authResponse) {
resolve(response.authResponse.accessToken);
} else {
reject({
error: 'User cancelled login or did not fully authorize.'
});
}
}, {
scope: 'public_profile,email'
});
then I try to get user data
FB.api('/me', {fields: 'first_name,last_name,email'}, function(response) {
console.log(response);
});
but I only get data for first_name and last_name. There is no email.
Also when I ask for permissions, it gives me email as granted, but as I said, email is not returned.
FB.api('/me/permissions', function(response) {
console.log(response);
});
Does anyone knows what can be the problem?
BTW: I am using API v2.4.
FB.api('/me?fields=email,name', function(response) { /* stuff here */ });
Try adding your return fields to your request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With