I am trying to get user's gender and birthday using Facebook Graph API using Node.js. My problem is that only the user's id and name are shown and I don't know why.
This is my code until now:
Facebook.js
var https = require('https');
exports.getFbData = function(accessToken, apiPath, callback) {
var options = {
host: 'graph.facebook.com',
port: 443,
path: apiPath + '?access_token=' + accessToken, //apiPath example: '/me/friends'
method: 'GET'
};
var buffer = ''; //this buffer will be populated with the chunks of the data received from facebook
var request = https.get(options, function(result){
result.setEncoding('utf8');
result.on('data', function(chunk){
buffer += chunk;
});
result.on('end', function(){
callback(buffer);
});
});
request.on('error', function(e){
console.log('error from facebook.getFbData: ' + e.message)
});
request.end();
}
And this is how I call it:
facebook.getFbData(access_token, '/me/friends', function(data){
This code return only the user Id and Name, how can I get his gender and age?