Home > Web Front-end > JS Tutorial > How to Retrieve Extended User Information Using Facebook's JS SDK?

How to Retrieve Extended User Information Using Facebook's JS SDK?

DDD
Release: 2024-12-31 11:00:10
Original
185 people have browsed it

How to Retrieve Extended User Information Using Facebook's JS SDK?

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);
});
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template