No age_range in facebook answer (javascript sdk)

I need to get the age range for the user (and not a friend)

By https://developers.facebook.com/docs/graph-api/reference/v2.1/user

user_range is part of /me node. But I decoded the response object and there is no age_range .

I am using javascript sdk on facebook. Is age_range available? as? still accessible via " signed _request "?

0
source share
2 answers

I was accessing /me node through the graphical API.

I found out that age_range does not return with the root object, but in order to get age_range I need to issue the following API call

 me?fields=age_range 

This gives me a JSON obejct age_range with minimum and maximum values.

+1
source

You need to explicitly tell the API that you need age_range as part of a public profile (no special permissions are required). The age of the user can be 13-17, 18-20 or 21+.

 /* make the API call v.2.3 */ FB.api( "/me?fields=age_range", function (response) { if (response && !response.error) { /* handle the result */ } } ); 

read the documentation https://developers.facebook.com/docs/graph-api/reference/age-range/

0
source

All Articles