Facebook only returning name and id of user
FB.api('/me?fields=first_name, last_name, picture, email', function(response) {
console.log(response);
document.getElementById('status').innerHTML =
'Thanks for logging in, ' + response.first_name + '!';
});
This worked for me. Pass email after /me?fields= in FB.api request.
Looks like you're using v2.4 of the Graph API. See
- https://developers.facebook.com/docs/apps/changelog#v2_4
Declarative Fields
To try to improve performance on mobile networks, Nodes and Edges in v2.4 requires that you explicitly request the field(s) you need for your GET requests. For example,GET /v2.4/me/feed
no longer includes likes and comments by default, butGET /v2.4/me/feed?fields=comments,likes
will return the data. For more details see the docs on how to request specific fields.
To get an idea how to use the so-called field expansion, have a look at
- https://developers.facebook.com/docs/graph-api/using-graph-api/v2.4#fields