facebook - restrict acces to a application facebbok only to my friends -


How to restrict access to only one Facebook application for my friends In this case, without using "sandbox" Facebook Connect "by

I know that he only needs the ID of his friends, but how does this technically go?

You list your code https://graph.facebook.com/me/friends By using your user's access token (no app token) Facebook will return a JSON array of your friends. You can read more information here:

You can then iterate through the JSON array and store a list in your server, e.g. In Java: Try

  JSONObject feedback = New JSONObject (txtResponse); ArrayList & LT; String & gt; MyFriends = New Arrestist & lt; String & gt; (); (Myfriends.add (response.data [i] .id);} // store list anywhere elsewhere (for int i = 0; i.ic. response.data.length; i ++) Jason Exception e) {// Something went wrong}   

On your client side, you can get user ID in Javascript. I am writing AJAX calls in jquery, just to be short You can use plain javascript.

  if (FB.getSession ()! = Null) {var session = FB.getSession (); if (session.uid === undefined ) Session = session.session; $ .post ("login", {id: sessio N.uid}, function (feedback) {// you arrive here, regardless of whether or not you want based on server decision based on login.});}   

Of course , Will reply to Ajax Post, which will be compared to ID in my Feeds list.

PS1: I wrote it on top of my head, so there may be typo / errors, but you get this idea .

PS2: Instead of the graph API, you can also use fql here. Information:

Comments