Search code examples
javascriptfacebookfacebook-graph-apifacebook-access-token

Fetch posts from Facebook page using FB API


Up until this summer, I had a website (not my website) which was fetching it's responding fb page posts and was displaying it on a page.

I was doing it using the app-token, which now doesn't work since it now requires Page Public Content Access to get those data, which in turn requires it to be registered as an app, which is beyond the scope of this.

I tried creating a non-expiring user-access token, but they seem to expire after 3 months, no matter the "trick" I tried using.

Is there any suggestion of how I can get over it?

Maybe an automated api call that would refresh the token with no user interaction?


Solution

  • So, I did it!

    Now the how: I did it with the manage_pages access, not with Page Public Content. I went back and forth a total of 5 times to get this to pass and a bit over a week.

    First of all Page Public Content is only allowed by Facebook when you want to analyze data from other pages as well, so you better not mess with it.

    What I had to do to get the request approved is specify on your application for requesting the access that there is no login, provide a copy of your code on the description and I also included a url where it was working with a user generated token through javascript, so they could review the code through a web debugger.

    After that you get a manage_pages token which you can use to fetch your pages posts

    I really hope some of those things were an overkill, but, like I said, I had to submit a review a total of 5 times, so on the last try I went all in...