Facebook 页面访问令牌

发布于 2024-12-17 14:59:38 字数 920 浏览 3 评论 0 原文

我有一个 Facebook 页面,我想从中获取一些东西。首先是提要,据我所知,它们是公开的(不需要 access_token)。但我也想获取事件......并且它们不是公开的并且需要 access_token。

我不希望用户登录 Facebook 或类似的东西。我只想从这个唯一的页面推送所有可以的数据。这就是为什么我已经放弃了在这里找到的许多示例以及 https://developers.facebook 上的示例。 com/blog/post/500/ ,因为他们希望用户登录或需要一些用户操作,我不感兴趣。

我想要的是我的 Facebook 应用程序拥有完全的授权和 access_token,可以从我拥有的这个 Facebook 页面(管理员)推送数据。这可能吗?我已经尝试了很多事情,但似乎没有任何效果。

我尝试单击此: https://www.facebook.com/dialog/oauth?client_id=150635421702954&redirect_uri=http://MY_URL/&scope=manage_pages&response_type=token&fields=access_token -将 MY_URL 更改为我网站的,并请求授权编辑我拥有的每个页面。即使不是我想要的,我点击了但没有 access_token 作为回报......

I have a Facebook Page that I want to get some things from it. First thing are feeds and from what I read they are public (no need for access_token). But I want to also get the events... and they aren't public and need the access_token.

I don't want the user to login in Facebook or anything like that. I just want to push all the data I can from this only page. That's why I already discarded many examples I found here and the one at https://developers.facebook.com/blog/post/500/ , because they want the user to login or require some user action I'm not interessed.

What I want is that my Facebook Application have full authorization and access_token to push the data from this one Facebook Page that I own (admin). Is this possible? I already tried many things but nothing seems to work.

I tried clicking at this: https://www.facebook.com/dialog/oauth?client_id=150635421702954&redirect_uri=http://MY_URL/&scope=manage_pages&response_type=token&fields=access_token - changing MY_URL to my site's and it requests authorization to edit every page I own. Even not being what I want I clicked but had no access_token in return...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

瞄了个咪的 2024-12-24 14:59:38
  1. 转到 Graph API Explorer
  2. 从下拉菜单中选择您的应用程序
  3. 单击“获取访问令牌”
  4. 选择manage_pages 权限(您可能还需要 user_events 权限,不确定)
  5. 现在访问 me/accounts 连接并复制您页面的access_token
  6. 单击页面的 ID
  7. 将页面的 access_token 添加到 GET 字段
  8. 调用所需的连接(例如:PAGE_ID/events
  1. Go to the Graph API Explorer
  2. Choose your app from the dropdown menu
  3. Click "Get Access Token"
  4. Choose the manage_pages permission (you may need the user_events permission too, not sure)
  5. Now access the me/accounts connection and copy your page's access_token
  6. Click on your page's id
  7. Add the page's access_token to the GET fields
  8. Call the connection you want (e.g.: PAGE_ID/events)
风蛊 2024-12-24 14:59:38

如果您想授予 Facebook 应用程序对页面的永久访问权限(即使您/应用程序所有者已注销),请参阅此处:

http://developers.facebook.com/docs/opengraph/using-app-tokens/

“应用程序访问令牌不会过期,除非您可以通过应用程序设置刷新应用程序机密。”

See here if you want to grant a Facebook App permanent access to a page (even when you / the app owner are logged out):

http://developers.facebook.com/docs/opengraph/using-app-tokens/

"An App Access Token does not expire unless you refresh the application secret through your app settings."

半夏半凉 2024-12-24 14:59:38

这方面的文档即使不是有点难找到,也很好。

Facebook Graph API - 页面令牌

初始化节点的 fbgraph 后,您可以运行:

var facebookAccountID = yourAccountIdHere 

graph
.setOptions(options)
.get(facebookAccountId + "/accounts", function(err, res) {
  console.log(res); 
});

并接收带有您想要的令牌的 JSON 响应抓取,位于:

res.data[0].access_token

The documentation for this is good if not a little difficult to find.

Facebook Graph API - Page Tokens

After initializing node's fbgraph, you can run:

var facebookAccountID = yourAccountIdHere 

graph
.setOptions(options)
.get(facebookAccountId + "/accounts", function(err, res) {
  console.log(res); 
});

and receive a JSON response with the token you want to grab, located at:

res.data[0].access_token
往日情怀 2024-12-24 14:59:38

我尝试从 Graph API Explorer 检索页面访问令牌,但没有选择页面的选项。

原来我不是该页面的管理员。我是 Facebook 应用程序的管理员,该应用程序可以访问 Facebook 页面,使我也能够访问该页面。这造成了混乱和混乱。

I was attempting to retrieve the Page access token from Graph API Explorer, but I did not have the option to select the Page.

It turns out that I was not an admin of the page. I was an admin of the Facebook App, and the App had access to the Facebook page, enabling me to access the page as well. This caused the confusion and chaos.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文