In this script
function fql(){
FB.api('/me', function(response) {
var query = FB.Data.query('select uid, name, email from user where uid={0}', response.id);
query.wait(function(rows) {
document.getElementById('name').innerHTML =
'Your name: ' + rows[0].name + "<br />" +
+ rows[0].email + "<br />" + rows[0].uid;
});
});
}
Function returns name and pic, but email value is NaN. App requires basic data and email (it was set in app properties/Auth dialog) but i cant get user email.
When I tested this query in Facebook test console, I’ve got email field with correct value.
Check that in Test Console and on your site you use the same application id and ensure that user have granted the
emailpermission to your application!This can be done with simple Graph API call:
Couple of things you should be aware of!
FB.Data.*is gone! It’s deprecated, undocumented and should not be used anymore! It’s just a matter of time for it to disappear from the JavaScript SDK code…FB.getUserID()), inFQLuseme()to refer to current user.Rewrite your usage of
FB.Data.*andquery.waitwith:In your case same results may be received by Graph API call without usage of FQL: