Facebook graph api 我如何授予Facebook应用程序发布到Facebook页面的特权(我两者都拥有)?
我不了解有关权限以及如何授予权限的重要内容。我制作了一个Facebook页面,我还制作了一个应用程序。我希望该应用程序能够发布到该页面 下面是我的代码。我正在使用fb_图形ruby gem,顺便说一句() 这就是错误:Facebook graph api 我如何授予Facebook应用程序发布到Facebook页面的特权(我两者都拥有)?,facebook-graph-api,permissions,Facebook Graph Api,Permissions,我不了解有关权限以及如何授予权限的重要内容。我制作了一个Facebook页面,我还制作了一个应用程序。我希望该应用程序能够发布到该页面 下面是我的代码。我正在使用fb_图形ruby gem,顺便说一句() 这就是错误: FbGraph::Unauthorized: OAuthException :: (#200) Requires extended permission: publish_actions 我已经在应用程序和页面设置中找到了所有我能想到的地方,但不知道如何做到这一点。谢谢你的帮助
FbGraph::Unauthorized: OAuthException :: (#200) Requires extended permission: publish_actions
我已经在应用程序和页面设置中找到了所有我能想到的地方,但不知道如何做到这一点。谢谢你的帮助 您需要通过用户访问令牌授予访问权限。 本例中的当前令牌是应用程序访问令牌 使用中列出的方法之一
具体地说我投票赞成phwd的答案,因为他/她在这里和IRC对我有帮助。但它仍然没有足够的信息来解释为什么这是如此困难。我决定发布我目前的工作理解,了解这是如何工作的。这些只是我自己的笔记,所以我很抱歉事先有任何不明白的地方
So, getting the right access tokens is f***ing hard, and here's my current understanding:
In order to get a token that last forever so that my app can post to a page I have to do this:
1. Create a short-lived user access token with the right scope for the app (manage_pages, publish_actions) using the explorer
- page access tokens can be obtained via /me/accounts from the explorer page
- if the user access token that is "live" during the /me/accounts request is short lived then this page access token will be too
- if it is an extended long-lived token the page access token will have no expiry according to https://developers.facebook.com/docs/facebook-login/access-tokens
2. Extend short-lived user access token to a long-lived one via a graph api call, also using exploer (see below)
3. Execute the /me/accounts call to get a page token that doesn't expire
How to get a long lived user access token
oauth/access_token?grant_type=fb_exchange_token&client_id=531------------&client_secret=e005f031ba3d98------------------&fb_exchange_token=CAAHjZA163IbMBAMKSeFTmeV9------------------------------------------------------------------------------------------------------------------------------------------------fonA4P4bPhhdveMLvZBKldEGCB7EvF301wQv1YPrudy5kvI
where
client_id = App Id
&client_secret = App Secret
&fb_exchange_token = short lived user access token via explorer with proper scope
This gives you the following long lived access token
access_token=CAAHjZA163Ib---------------------------------------------------------------------------------------------------------------------------------------------------------------------ehS8g2ZBYU8uZBPmdMay3AAj5tXgAZDZD&expires=5179843
This is an extended user access_token
This token can be used to post to the page it was genrated for.
It can also be used to get a no-expiry page access token when used to issue /me/accounts
来自:
页面访问令牌
这些访问令牌与用户访问令牌类似,只是它们为读取、写入或修改属于Facebook页面的数据的API提供权限。要获取页面访问令牌,首先需要获取用户访问令牌并请求“管理页面”权限。一旦您拥有用户访问令牌,您就可以
So, getting the right access tokens is f***ing hard, and here's my current understanding:
In order to get a token that last forever so that my app can post to a page I have to do this:
1. Create a short-lived user access token with the right scope for the app (manage_pages, publish_actions) using the explorer
- page access tokens can be obtained via /me/accounts from the explorer page
- if the user access token that is "live" during the /me/accounts request is short lived then this page access token will be too
- if it is an extended long-lived token the page access token will have no expiry according to https://developers.facebook.com/docs/facebook-login/access-tokens
2. Extend short-lived user access token to a long-lived one via a graph api call, also using exploer (see below)
3. Execute the /me/accounts call to get a page token that doesn't expire
How to get a long lived user access token
oauth/access_token?grant_type=fb_exchange_token&client_id=531------------&client_secret=e005f031ba3d98------------------&fb_exchange_token=CAAHjZA163IbMBAMKSeFTmeV9------------------------------------------------------------------------------------------------------------------------------------------------fonA4P4bPhhdveMLvZBKldEGCB7EvF301wQv1YPrudy5kvI
where
client_id = App Id
&client_secret = App Secret
&fb_exchange_token = short lived user access token via explorer with proper scope
This gives you the following long lived access token
access_token=CAAHjZA163Ib---------------------------------------------------------------------------------------------------------------------------------------------------------------------ehS8g2ZBYU8uZBPmdMay3AAj5tXgAZDZD&expires=5179843
This is an extended user access_token
This token can be used to post to the page it was genrated for.
It can also be used to get a no-expiry page access token when used to issue /me/accounts