Making Page Access Tokens Never Expire With 2016 Facebook SDK?

前端 未结 1 853
谎友^
谎友^ 2021-01-07 03:01

The application we are building is both an iOS and Android mobile app that pairs high school students with nonprofits to help manage their Facebook pages. We assign each stu

相关标签:
1条回答
  • 2021-01-07 03:27

    Steps:

    1. Get the user-access-token having the permission manage_pages with it.
    2. Extend the token using (do it server side, since it involves app secret)

      https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id={your_app_id}&client_secret={your_app_secret}&fb_exchange_token={user_token_from_last_step}

    3. Use the extended token from above step and use the API-

      /v2.5/{page-id}?fields=access_token
      

      You'll get the page access token in response, that'll never expire.

    I think you're at step 2, just follow the step 3 and you're good to go.

    I'll recommend you go through this page about the access tokens and things will be much clearer.

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