I think you want to use me/friends
after they've logged in. The response will be an Array you can loop over, so you can get each User id
property and make more calls to FB.api()
using the id, if desired.
This is probably what you want to do:
fbAsyncInit = function(){
FB.init({
appId: 'yourAppIdHere',
version: 'v2.5'
});
FB.getLoginStatus(function(response){
if(response.status === 'connected'){
FB.api('me/friends', function(a){
for(var i=0,l=a.length; i<l; i++){
/* make a call for each friend with more .api calls - a is array of User objects - props seen here https://developers.facebook.com/docs/graph-api/reference/user/ */
FB.api(a[i].id, function(r){
});
}
});
}
else{
location = 'https://www.facebook.com/dialog/oauth?client_id=replaceThisWithAppId&redirect_uri='+location;
// change out replaceThisWithAppId above
}
});
}
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if(d.getElementById(id)){return;}
js = d.createElement(s); js.id = id;
js.src = '//connect.facebook.net/en_US/sdk.js';
fjs.parentNode.insertBefore(js, fjs);
})(document, 'script', 'facebook-jssdk');
/me/friends
is what you need to get the friends of the user that are users of your app as well. – CBroe