开发者

i can't retrieve a facebook user's friends list with as3

开发者 https://www.devze.com 2023-02-27 01:34 出处:网络
hey all i am trying to write a facebook app using as3 and the facebook-actionscipt graph api library i am having trouble getting a user\'s friends list, while i have no problem getting a user\'s othe

hey all i am trying to write a facebook app using as3 and the facebook-actionscipt graph api library

i am having trouble getting a user's friends list, while i have no problem getting a user's other data (favorite movies, for example)

this is strange since getting a user's friends list is the only thing that is available to anyone on facebook: http://developers.facebook.com/docs/reference/api/user/

this function returns an array of movies succesfully:

function loadMovies() {
 Facebook.api('/' + userID + '/movies',onLoadedMovies);
}

func开发者_开发技巧tion onLoadedMovies(response:Object, fail:Object):void {
 (response) ? movies = response : trace(fail);
}

while this one returns an IOerror in the fail (response=null):

function loadFriends() {
 Facebook.api('/' + userID + '/friends',onLoadedFriends);
}

function onLoadedFriends(response:Object, fail:Object):void {
 (response) ? friends = response : trace(fail);
}

please note that userID is one of the app-user's friends, not the app-user himself

any ideas why this is happening?

thanx Saar

----edit:

ok after doing some more searching i find that getting friends-of-friends with any api is impossible

this is very interesting - you can access friends-of-friends manually as a facebook user, but not automatically

this means it is not a privacy issue at all - it is something Facebook wants to keep for itself only - for the "People You May Know" section in the facebook page


You can't get the friends of friends, that would require an accesstoken of the friend :) So there is actually no way you can get the friends of a friend of your user :)

to get the accesstoken of your user, you can use this:

var _params:Object = new Object();

_params.access_token = Facebook.getSession().accessToken;

Facebook.api("/" + _userID + "/friends", messagePosted, _params, "POST");

but this will normally not grant you access to the friends' friends.

0

精彩评论

暂无评论...
验证码 换一张
取 消