Domanda

I have a website making server side-server side calls to Facebook to get the associated Facebook page posts. We did this to retrieve the json data, then display it in a website built in Flash. We're using this endpoint:

   /app_id/posts?access_token=xxxx

This all worked great until the Facebook page recently set the country restriction to USA only, and now this is no longer working. Many other developers suggest I need a user access token, however; this solution is not acceptable as we would need to ask every visitor to add the app to their page, when we're not even accessing their data. A user token is out of the question. It also seems like an abuse to the system as we're not doing anything on the client side except actually passing along the posts for Flash to consume.

Is there a way to use an app access token to access a Facebook page that has a country or age restriction added to it?

Here's what we get on response with a page that has country restrictions added:

    {
      "data": [
      ]
    }

Looking at the options for the Facebook Page, there doesn't seem to be a clear way to grant special access to the app, or the app token... So, is this just a situation that Facebook didn't consider when removing the offline_access access? How does one bring in stylized facebook posts for their brands?

È stato utile?

Soluzione

You must remove all age and country restrictions from your page in order to allow an app (using an App Access Token) to access your page and get the feeds.

If you can't remove those restrictions, you need to generate an access token and renew it automatically in the background:

  1. Log into Facebook as a user who has admin permissions to the relevant Facebook page.

  2. Then go to this link: https://www.facebook.com/dialog/oauth?client_id={your-app-id}&redirect_uri={a-link-back-to-your-website}&scope=manage_pages,publish_stream&response_type=token

    This link will pop-up a confirmation dialog and will grant the "Manage Pages" and "Post" permissions to the app.

  3. Once confirmed, the app from now on will be able to post and manage your pages using the access token that appears in the url of the redirect uri.

  4. Save that access token for further use by your server.

Hope this helps.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top