I am currently using the following to get basic user info from facebook using a token.
var options = {
host: 'graph.facebook.com',
port: 443,
path: '/me/?access_token=' + token
};
https.get(options, function(result) {
var fbResponse = '';
result.on('data', function(chunk) {
fbResponse = JSON.parse(chunk);
console.log(fbResponse.error.type);
}
How can I get the age_range field? It is one of the default provided information that doesn't require any additional permissions.
You'll have to explicitly tell the API that you need age_range
. You can do this by specifying it in the fields
parameter. For example:
/me?fields=age_range&access_token={token}
This should return something like:
{
"age_range": {
"min": 21
},
"id": <user_id>
}