Hothi Jimit Hothi Jimit - 2 months ago 10
PHP Question

Email address permissions not getting in Facebook through the JS SDK

I am trying this script:

FB.api('/me?fields=id,name,email,birthday,first_name,picture{url},gender', function(response) {
if(response.status == 'connected'){
alert('I am connected');
alert('Email: ' + response.email);
}
},{perms: 'email'});


or

FB.api('/me?fields=id,name,email,birthday,first_name,picture{url},gender', function(response) {
if(response.status == 'connected'){
alert('I am connected');
alert('Email: ' + response.email);
}
},{scope: 'email'});


i am get user email address

how to get this ?

Answer

did you pass in email permission to scope when facebook login? Example:

FB.login(function(response) {
   // handle the response
 }, {scope: 'public_profile,email'});