长期访问令牌Facebook页面 [英] Long Lived access token Facebook Page

查看:158
本文介绍了长期访问令牌Facebook页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Facebook页面,我想要的页面的feed。
我正在使用图形API来获取访问令牌,但我不知道如何将该短命令访问令牌转换为长期访问令牌

  https://graph.facebook.com/oauth/access_token? 
client_id = APP_ID& client_secret = APP_SECRET&安培; grant_type = fb_exchange_token&安培; fb_exchange_token = EXISTING_ACCESS_TOKEN

如果以上链接用于获取长实时访问令牌,那么从哪里可以得到App_Secret

如果我进行错误的方法,请帮助我。

解决方案


  1. 首先,从这里


  2. 要获得扩展的用户令牌(有效期:2个月),请使用您在问题。



    您可以从 Apps 页面获取应用程式的秘密。


  3. 要获得粉丝专页永不过期的令牌。按照简单的步骤:




    • 使用您通过步骤2获得的用户令牌,获取页面/应用程序列表 - p>

        $ facebook-> api(/ USER_ID / accounts); 


    • 获取任何页面永不过期的访问令牌 -

        $ facebook-> api(/ PAGE_ID?fields = access_token); 



(您可以使用 Facebook的调试工具查看令牌的有效性。)


I have a facebook page and i want the feeds of page. I am using graph api to get the access token but i have no idea how to convert that short-lived access token to long-lived access token

 https://graph.facebook.com/oauth/access_token?
 client_id=APP_ID& client_secret=APP_SECRET& grant_type=fb_exchange_token& fb_exchange_token=EXISTING_ACCESS_TOKEN

If above link is used to get the long live access token then from where i can get App_Secret
Help Me if i am going on wrong approach.

解决方案

  1. First of all, learn the basic concepts and the different kinds of the access tokens from here

  2. To get the extended User token (validity: 2months) use the code you have mentioned in the question.

    You can get the app secret from the Apps page.

  3. To get a never expiring token for your fan page. Follow the simple steps:

    • Using the user token you obtained through step 2, get the list of pages/apps-

      $facebook->api("/USER_ID/accounts"); 
      

    • Get the never expiring access token for any page-

      $facebook->api("/PAGE_ID?fields=access_token");
      

(You can use Facebook's Debug Tool to check the validity of the token.)

这篇关于长期访问令牌Facebook页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆