Retrieving Extended User Information from Facebook JS SDK's FB.api(/me)
In Graph API v2.4 , retrieving extended user information, such as email, birthday, and first/last names, by simply calling FB.api('/me') no longer suffices. To address performance optimizations in mobile networks, the API now requires explicit field specification.
Solution:
To obtain the desired information, manually specify each field in your FB.api call:
FB.api('/me', 'get', { access_token: token, fields: 'id,name,gender,email,birthday' }, function(response) { console.log(response); });
This code will fetch the specified fields (id, name, gender, email, and birthday) from the user's profile. Remember to include the necessary scopes (e.g., 'email', 'user_birthday') when requesting sensitive information.
The above is the detailed content of How to Retrieve Extended User Information Using Facebook's JS SDK?. For more information, please follow other related articles on the PHP Chinese website!