Posts from Instagram not showing up on Facebook Open Graph API

后端 未结 2 1252
一向
一向 2021-02-04 09:39

I have an issue with Facebook OpenGraph API. Whenever I request data using either \'/home\' or \'/feed\', none of the posts from Instagram showed up.

I\'ve been googling

2条回答
  •  迷失自我
    2021-02-04 10:35

    There are two bug reports in Facebook's bug tracker about this: https://developers.facebook.com/bugs/110563582419837 and https://developers.facebook.com/bugs/202119973248747

    The core reason is that the photos are attached to Open Graph actions as User Generated Photos and not via the regular Photo upload API.

    As such, the regular photos permissions don't grant access to them and you need the user to specifically allow you the access their Open Graph activity for the app that posted the actions. The bug reports above are accepted on the basis that this appears to be an oversight in the case of actions with user generated photos, but it could also be by design in which case what i've outlined below as a workaround would be the only supported way to do this:

    If you specifically need to request Instagram (or another Open Graph photos app) photos for a user, you can ask for Permission to access the actions posted by that app.

    For Instagram photos you can do this by requesting the user_actions:instapp permission and once you've done that the Instagram Photos album will no longer appear to be empty, and the Instagram activity will appear in the feed connection.

    To find out the namespace for an arbitrary app, access https://graph.facebook.com/ and look for the namespace field,

    e.g. for instagram, a call to https://graph.facebook.com/124024574287414/?fields=id,namespace returns:

    {
      "id": "124024574287414", 
      "namespace": "instapp"
    }
    

    A sample photo from my own /feed connection, retrieved with the read_stream, user_photos, user_actions:instapp permissions, is:

    {
      "data": [
        {
          "id": "[SNIPPED]", 
          "from": {
            "name": "[SNIPPED]", 
            "id": "[SNIPPED]"
          }, 
          "picture": "[SNIPPED]", 
          "link": "https://www.facebook.com/photo.php?fbid=[SNIPPED]", 
          "icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yb/x/StEh3RhPvjk.gif", 
          "privacy": {
            "value": ""
          }, 
          "type": "photo", 
          "object_id": "[SNIPPED]", 
          "application": {
            "name": "Instagram", 
            "namespace": "instapp", 
            "id": "124024574287414"
          }, 
          "created_time": "2013-01-07T17:33:04+0000", 
          "updated_time": "2013-01-07T17:33:04+0000", 
          "comments": {
            "count": 0
          }
        }, 
    

    I can also access the /photos connection of my 'Instagram Photos' album with the same permissions, and can access all Instagram 'take' actions (i.e the photos) at /me/instapp:take

提交回复
热议问题