检索 Facebook 页面所有者/管理员的个人资料 ID
在 PHP SDK 的早期版本中,应用程序能够获取拥有安装应用程序的页面的用户的配置文件 ID。
$facebook->get_profile_user()
这在没有最终用户授权访问 Facebook 应用程序的情况下是可能的。
但是我在新的 JS 或 Graph API 中找不到任何类似的东西。我能找到的最接近的东西是 https://graph.facebook.com/
,但是这个调用似乎不起作用,或者需要额外的权限:
Access Token:AAADF5PRI7BkBAKSz9Wqfbkuib6JH7WkZCQDZBgLNO10s1ZAMKF7BO7Y3YCVqkYNuCJ9QroWHYYn8n5wC8diPuBDPGsNUS5tDnZAZA6rFSx28VtpvVhUlY
Graph API: /210093142392039/admins
$this->facebook->api('/291231207559006/admins')
( ! ) Fatal error: Uncaught OAuthException: (#210) Subject must be a page. thrown in /html/classes/facebook/base_facebook.php on line 1033
是这样的功能没了?我们使用配置文件 ID 作为数据源中的密钥,因此最好保留相同的密钥,如果没有,我们可以开始存储页面 ID,但这将导致用户必须重新初始化应用程序。
In a previous version of the PHP SDK there was the ability in an App to get the Profile ID of the user that owned the page where the app was installed.
$facebook->get_profile_user()
This was possible without having the end user authorize access to the Facebook App.
However I can't find anything similar in the new JS or Graph API's. The closest thing I could find was the https://graph.facebook.com/<page_id>/admins
, however it seems this call either doesn't work, or requires addition permissions:
Access Token:AAADF5PRI7BkBAKSz9Wqfbkuib6JH7WkZCQDZBgLNO10s1ZAMKF7BO7Y3YCVqkYNuCJ9QroWHYYn8n5wC8diPuBDPGsNUS5tDnZAZA6rFSx28VtpvVhUlY
Graph API: /210093142392039/admins
$this->facebook->api('/291231207559006/admins')
( ! ) Fatal error: Uncaught OAuthException: (#210) Subject must be a page. thrown in /html/classes/facebook/base_facebook.php on line 1033
Is this functionality gone? We were using the Profile ID as a key in a datasource, so it'd be ideal to keep this same key, if not we can start storing the page-id instead, however this would the users would have to reinitialize the app..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
2011 年 9 月 22 日之后,需要管理页面权限才能执行此操作。
您必须请求manage_pages权限,获取页面access_token,然后使用页面access_token发出管理员请求。
请参阅 http://developers.facebook.com/docs/reference/api/permissions / 获取更新的权限。
After September 22, 2011, manage_pages permission is required to do that.
You must request for the manage_pages permission, get the page access_token and then make the admins request with the page access_token.
Please refer to http://developers.facebook.com/docs/reference/api/permissions/ for updated permissions.
好吧,实际上我不久前也遇到过同样的问题并找到了解决方案。我所做的是传递用户访问令牌而不是页面访问令牌。我建议你应该尝试类似的事情
然后尝试
Well, I actually had the same problem some time back and found a solution for it. What i was doing was passing the user access token intead of the page access token. I would suggest that you should try something like
and then try