在直接用户没有访问令牌的情况下访问Open Graph FB页面见解 [英] Accessing Open Graph FB page Insights without the direct user having an access token

查看:91
本文介绍了在直接用户没有访问令牌的情况下访问Open Graph FB页面见解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Laravel使用PHP后端为我的本地年轻专业人员组织搭建了一个平台.我要采取的最新举措之一是整合我们的营销见解,并使董事会无需直接进入软件即可快速了解我们的营销工作,例如我们的Piwik设置和FB页面见解.

I have built a platform for my local young professionals organization with a PHP backend using Laravel. One of the newest initiatives I am wanting to take on is the integration of our marketing insights and for the board to take a quick look at our marketing efforts without needing to be directly in the software, such as our Piwik setup and FB page insights.

我已经打开了Open Graph/FB SDK,并配置了一些基本API以便在软件中使用.我要这样做,以便在FB页上没有管理员访问权限的董事会成员仍然可以看到这些见解.是否可以使用应用访问令牌来获取见解?是否所有需要查看PHP页面的董事会成员都必须以具有管理员权限的页面登录FB?

I have pulled the Open Graph/FB SDK and have configured some basic APIs to use in the software. I am wanting to make it so board members without admin access on the FB page can still see the insights. Is it possible to use an app access token to grab the insights? Do all of the board members viewing the PHP page need to be logged into FB with admin access to the page?

推荐答案

如果您使用的是长期(永久)的页面访问令牌,则可以这样做.首先,您必须获取用户访问令牌,例如通过图形浏览器( https://developers.facebook.com/tools/explorer ),其中manage_pagesread_insights权限.

This is possible if you use a long-lived (eternal) Page Access Token.First, you'd have to get a User Access Token, for example via the Graph Explorer (https://developers.facebook.com/tools/explorer), with manage_pages and read_insights permissions.

然后,您需要将返回的短期用户访问令牌替换为长期的用户访问令牌.接下来,请求具有长期用户访问令牌的/me/accounts并从结果中获取永恒的页面访问令牌.将其存储在您的应用程序中以备将来使用.

Then, you need to exchange the returned short-lived User Access Token with a long-lived one. Next, request /me/accounts with the long-lived User Access Token and fetch the eternal Page Access Token from the result. Store it your application for further use.

您可以通过以下方式检查访问令牌

You can check the Access Token with

https://developers.facebook.com/tools/debug/

看看

  • https://developers.facebook.com/docs/facebook-login/access-tokens#pagetokens
  • https://developers.facebook.com/docs/facebook-login/access-tokens#extending
  • https://developers.facebook.com/docs/graph-api/reference/v2.2/page/insights/
  • https://developers.facebook.com/docs/graph-api/reference/v2.2/insights/

这篇关于在直接用户没有访问令牌的情况下访问Open Graph FB页面见解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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