How to get a Facebook access token for a page with no app or app secret

后端 未结 2 1976
迷失自我
迷失自我 2020-12-16 05:38

I am trying to automatically display wall posts from a Facebook page another website. I can use the Graph API explorer to get one manually. When I use the generated token in

相关标签:
2条回答
  • 2020-12-16 05:50

    For graph objects that are not private (public) you can use your app_id as an access_token.

    Your app_id never changes so you don't ever have to renew it. The question is is the wall content yours?

    If so you can easily use your app_id to accomplish this without having to request an access token everytime.

    However, in order to have an app_id you need to create an application on facebook with a facebook developer account. As far as I understand there isnt a way to anonymously make request to the Graph API,

    0 讨论(0)
    1. Use the app-id to build this link to authorize the managing of pages https://www.facebook.com/dialog/oauth?client_id=MY_CLIENT_ID&redirect_uri=MY_SITE_URL&scope=manage_pages&response_type=token

    2. Exchange token for perm (longer token)
      https://graph.facebook.com/oauth/access_token?client_id=MY_CLIENT_ID&client_secret=MY_CLIENT_SECRET&grant_type=fb_exchange_token&fb_exchange_token=(from link1)

    3. Visit this page, find the PAGE you want to post and copy the new access_token https://graph.facebook.com/me/accounts?access_token= (from link2)

    4. Use this last token (form link3) to post to page as app

    5. Take note as it will expire in 60 days. (FB no longer offering unlimited offline access token)

    Edit (2013 Oct 24): 5th point no longer true, Page Access Tokens generated from long-lived User Tokens do not expire.

    Edit (Feb 2016): Tokens now "usually" expire in 60 days but can be invalidated at any time.

    0 讨论(0)
提交回复
热议问题