Retrieving facebook user wall posts through graph API

30,391

Solution 1

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.

Solution 2

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.

Solution 3

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/

Share:
30,391
Admin
Author by

Admin

Updated on July 05, 2022

Comments

  • Admin
    Admin almost 2 years

    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?

  • DMCS
    DMCS over 12 years
    Oops, my bad, it was bad copy paste of the url. It was missing the /feed from it. Thanks Lix for pointing out the mistake
  • Lix
    Lix over 12 years
    Only thing i can get off him with no token is his big smile... /zuck/picture
  • Lix
    Lix about 12 years
    So that's how you get to 10K so fast. ;)
  • Admin
    Admin over 10 years
    So how would you get those public, but not accessible (woah) posts?
  • Ionică Bizău
    Ionică Bizău over 9 years
    So, in conclusion, how to get real user feeds instead of an empty array?
  • Vincent
    Vincent about 9 years
    thank you for the permission keys hints. I only grant read_stream permission at the beginning, I can see all posts that I shared to others, somehow I can't see my own posts.