I'm looking for a snippet to get ids of friends who use my app.
I wrote this:
FB.api('/me/friends', function(response) {
amis = response.data;
console.log(amis[].id);
});
On login I asked for {scope:'public_profile , user_friends'});
I'm looking for a snippet to get ids of friends who use my app.
I wrote this:
FB.api('/me/friends', function(response) {
amis = response.data;
console.log(amis[].id);
});
On login I asked for {scope:'public_profile , user_friends'});
I am not sure what the problem is, but you can try this if you just want to output all ids:
FB.api('/me/friends', (response) => {
if (response && response.data) {
for (let i = 0; i < response.data.length; i++) {
console.log(response.data[i].id);
}
}
});