When retrieving basic information using the Facebook API's FB.api('/me'), only the user's name and ID may be returned. To obtain additional fields such as email, first name, last name, and birthday, it is necessary to specify them explicitly.
The Graph API version 2.4 and later requires manual field specification. The following changes should be made to the provided code:
FB.api('/me', 'get', { access_token: token, fields: 'id,name,email,first_name,last_name,birthday' }, function(response) { console.log(response); });
In this updated code, the 'fields' parameter lists the desired fields to be returned. By specifying these fields, the API call will now provide a more comprehensive response.
For further reference, consult the following documentation:
The above is the detailed content of How Can I Retrieve More Than Just Name and ID Using FB.api('/me') After Graph API v2.4?. For more information, please follow other related articles on the PHP Chinese website!