2

I am building a small facebook app. In my app I am trying to get a list of my friend's friends. When I perfrom this I receive an error from facebook that I cannot select information about people that are not me (I was trying to retrieve my friend's friends )

Here is an example of what I mean:

User A - Uses the application
User B - Friend of user A and also uses the application

I want User A to be able to see a list of all of user's B friend's who are using the application as well.

Is there any way to get arround that? How can I do this?

Sahil Mittal
  • 20,697
  • 12
  • 65
  • 90
vondip
  • 13,809
  • 27
  • 100
  • 156
  • 8
    Actually I hope facebook won't let you do that xD... It would seem like a privacy/ security failure to me :-P – webdreamer Dec 13 '09 at 21:11
  • hi there webdreamer. I understand what you mean, well they can perhaps give an extended permission to allow that. I want to show a user a list of all that things his friend's has got on the application and give him the option to search his friends and check what their friend have got on the application. – vondip Dec 13 '09 at 21:14
  • 1
    I don't think they would give an extended permission, because of the following: when you install application they ask for permission to use your data. They can't, basing on that, go fetch information on people whom you did not ask anything to. What you could perhaps do (I don't know how facebook apps work) is keep a database of everyone who ever authorized your app, and then cross it. If their friends already authorized the app, then you could access their friends list of friends.I don't know exactly what you want to do, but that's the limit of what I think facebook will reasonably allow. – webdreamer Dec 13 '09 at 22:33
  • Simply not currently possible without violating FB's tos; it would only be possible if all of user A's friends had authorized your app at some point and you had cached each user's friends list (which we're not allowed to do). – defines Dec 14 '09 at 15:22
  • Possible duplicate of http://stackoverflow.com/questions/1330123/get-a-list-of-friends-of-a-friend-on-facebook – defines Dec 14 '09 at 15:24

1 Answers1

2

The way to get a list of friends for someone is by using the friends.get API method. However, webdreamer is correct in that you can't just pick any Facebook ID you want and start pulling out friend information for that person. The person you query about has to have authorized your application... otherwise any app developer could find out anything about anyone on Facebook, which would be a privacy nightmare.

It's tough to tell exactly what you want to do though, as your comments say you just want the friends of a user, and your original question says you want the friends of the friends. The first is possible... the second is not.

For the first, all you need to do is have someone add/authorize your app. After that, friends.get will work fine with that user's session key, which will be provided to your application, and you can get a list of their friends.

mgraph
  • 15,238
  • 4
  • 41
  • 75
zombat
  • 92,731
  • 24
  • 156
  • 164