Reputation: 466
I'm currently building an application which requires users to log in with their facebook account. Next I want the user's birthday, location, first- and lastname. To get the user's name isn't a problem but the location and birthday is not working properly.
I'm scoping to ask the user for permission to access his/her data:
function loginUser() {
FB.login(function(response) { }, {scope:'user_birthday,user_location'});
}
And next I want to write the user's location to the console just for testing:
function testAPI() { FB.api('/me?fields=user_location', function(response) { console.log('Good to see you, ' + response.user_location + '.'); });
Any idea's how to get this data? Thanks in advance!
Upvotes: 0
Views: 2330
Reputation: 3630
user_birthday
and user_location
are the names of the permissions, not the field names; these are birthday
and location
. The following works for me:
function testAPI() {
FB.api('/me?fields=birthday,location',
function(response) {
console.log('Good to see you, user from ' + response.location + '.');
});
}
Upvotes: 1