扩展Facebook打开图表令牌发布到页面 [英] Extend Facebook Open Graph Token For Posting to Pages

查看:179
本文介绍了扩展Facebook打开图表令牌发布到页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用本教程(从该页的第一个答案)。

I'm using this tutorial (from the first answer on that page).

简而言之,它使用FB应用程序和PHP CURL GET通过HTTP发布到您的Facebook页面。

In short it uses a FB app, and PHP CURL GET to post to your Facebook page via HTTP. I have it working and can post to my page (as my page) with the correct token.

但是,页面访问令牌只持续一个小时,这意味着您必须通过生成新令牌不断重新授权。我如何设置和忘记,或以其他方式扩展我的令牌?我已阅读facebook文档,但无法将其应用于我的场景。

However, the page access token only lasts an hour, meaning you have to constantly re-authorize by generating a new token. How can I set-and-forget, or otherwise extend my token? I have read the facebook documentation but can't apply it to my scenario.

我只想授权一次,接收一个令牌,让我的网络表单能够发布

I just want to authorise once, receive a token and have my web form be able to post to my page.

推荐答案

当您(管理员用户)进行身份验证时,您会获得页面访问令牌。页面令牌基于您的短期用户令牌。为了得到一个长期的页面令牌,你需要得到一个长期的用户令牌。

You get your page access token when you (the admin user) authenticate. The page token is based on your short-lived user token. In order to get a long-lived page token you need to get a long-lived user token. They usually last around two months.

以下是如何获取长效页面令牌的方法。

Here's how you get a long-lived page token.


  1. 获取短期用户令牌。

  2. 获取您的应用ID和应用秘密。

  3. code> https://graph.facebook.com/oauth/access_token&grant_type=fb_exchange_token&client_id= {app-id}& client_secret = {app-secret}& fb_exchange_token = {short-lived-token}

  4. 现在使用从步骤3返回的令牌创建一个新的长期页面令牌。
  1. Get a short-lived user token.
  2. Get your app ID and app secret.
  3. Make the following GET call: https://graph.facebook.com/oauth/access_token&grant_type=fb_exchange_token&client_id={app-id}&client_secret={app-secret}&fb_exchange_token={short-lived-token}.
  4. Now use the token returned from step 3 to create a new long-lived page token.

这篇关于扩展Facebook打开图表令牌发布到页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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