18

I'm trying to get wall posts from a certain user using the JavaScript Facebook SDK. When I use the graph API Explorer, it works fine; but when I try the same thing on my website, I get the following error:

code: 104
message: "An access token is required to request this resource."
type: "OAuthException"

Where can I find my access token, so that I can show my company's Facebook page stream on my website?

1 Answer 1

37

Yes, you need an Access Token to fetch posts made by a Facebook Page. As the page posts are public, any access token will work. You should use an app access token as it never expires.

  1. Visit https://developers.facebook.com/apps and create a new app
  2. Fill in the desired App Name and Namespace
  3. In the section 'Select how your app integrates with Facebook' choose 'Website with Facebook Login'
  4. Enter your website URL in the 'Site URL' field. Remember to add a trailing '/'
  5. Visit here to get your App Token.

Make calls to the graph API to fetch page posts

https://graph.facebook.com/pageID/feed?access_token=your_token
3
  • 2
    Thank you very very much! :) This is what i needed. Have a great life! Apr 17, 2013 at 8:13
  • Won't this expose the token or app secret on the client side? Correct me if I'm wrong, but I've heard that you should never have the token appear client side which makes the JS SDK a pickle to use. Aug 16, 2016 at 1:27
  • Can I use the FB api on a 0.0.0.0 server, or does it have to be on a domain? Oct 12, 2016 at 2:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.