Home Fetch Own Feed From Facebook API
Reply: 0

Fetch Own Feed From Facebook API

user2319 Published in May 20, 2018, 11:39 am

I know this question has been asked a lot, but with the latest changes to Facebook I'm having a hard time figuring out how to accomplish this task. Many tutorials and answers are no longer relevant due to these changes.

What I want to do is fetch my own personal Facebook feed posts (my posts) and display them on a "News" section on my website. I want to use the Graph API as the Facebook Page social plugins have strange width restrictions that do not work for me.

To access my OWN posts on my OWN feed to place on my OWN website, I seem to be having a hard time getting a working access token. Do I need to do a "Facebook Login" for permission handling?

I've created a Facebook Developer account, created an App and seem to be successfully fetching a token with the following code:

let myToken = ''

  .then(response => response.json())
  .then(token => (myToken = token.access_token))
  .catch(e => console.log(e))

When I go to use that token:

  .then(response => response.json())
  .then(data => console.log(data))
  .catch(e => console.log(e))

I'm getting an error: An active access token must be used to query information about the current user.

I don't want any user interaction (commenting, "likes", etc), all I simply want is to read the message and load an image if one is present. I'll refer the visitor to a "View On Facebook" link for the interaction.

Using the Graph API Explorer Tool, I am able to successfully get data but I need to choose "Get User Access Token" and select a bunch of permissions.

I can take the token from Graph API Explorer and get my desired code working but it only lasts 1 hour (short lived) to 2 months (long lived). And would rather not continually update a hard-coded token into my page.

Am I missing something here?

Thanks in advance.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.307553 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO