4
votes

I'm currently working on a facebook app which captures wall posts for a specified user, page or group, after a user has authorized the app I quote the access_token that is returned to call the method

https://graph.facebook.com//feed?access_token=

this works fine for pages and groups as we only need a valid token, however for users the results are different depending on the relationship between the user who authorized the app the user whose posts are being captured.

For example if there is no relationship between the two users some posts are not returned even though they are public and displayed when you view the profile of the user, however if they are friends more posts are returned.

Can someone please explain this behaviour? And is it possible to obtain all posts using this method?

4

4 Answers

6
votes

Yes, per the permissions listed at https://developers.facebook.com/docs/reference/api/permissions the results of the call are different depending upon the relationship.

However when things are public and you use an access token that doesn't belong to the user, then no results are returned. I cannot remember a time when this wasn't this way. For some odd reason (by design or omission on Facebook's part) using the graph API to get at public posts using a user access token just doesn't want to work.

For example, You can see some public items here

http://www.facebook.com/zuck http://graph.facebook.com/zuck

However, you cannot seem to get any feed from here without an access token

https://graph.facebook.com/zuck/feed

{
   "error": {
      "message": "An access token is required to request this resource.",
      "type": "OAuthException"
   }
}

Let's try adding an user access token that does not belong to zuck or a friend of zuck. https://graph.facebook.com/zuck/feed?access_token={UserAccessToken}

And here's what we get:

{
   "data": [

   ]
}

What about an app access token? Let's try https://graph.facebook.com/zuck/feed?access_token={AppAccessToken}

{
   "error": {
      "message": "Invalid OAuth access token signature.",
      "type": "OAuthException"
   }
}

So as you can see, it's difficult to get things via the graph that are not in alignment with your access token.

3
votes

I manage to get most of the feeds from user's wall post. Although this is a old post, I hope someone can manage to get what they want from my answer.

Before getting the access token(to get the feeds), you need to add multiple correct Read Permissions "keys". For example, you will have to add "read_stream", and "user_status" (which I found that these are the most important permission "key" to generate the correct access token, to retrieve one's so-called "public" feeds).

You can add more into generating the access token, in either you want the permission to GET, or POST, or BOTH.

Source is here: https://developers.facebook.com/docs/howtos/ios-6/#nativeauthdialog

One thing that I found is, the way to get the feeds result from user's "Home/About" page and Facebook Page (which is created for people to like (not add friends)) are different. The key is mentioned above, "read_stream", and "user_status". So it's better that you add both of the permissions in order to generate the access token to get everything in feeds.

1
votes

Graph API doesn't return posts to the App if is not authorized to read user feed, even if posts are public.

Source: https://developers.facebook.com/bugs/290004301178437/

0
votes

According to the latest api ,

FB.api("/me/feed","get",function(response) {//callback})

should do and also work well . It is working now but facebook may change it in future.