如何检查 Facebook 的特殊权限
我如何检查 JavaScript 用户是否已授予我的网站发布流权限
?
how can i check in javascript
if user has granted my site the publish stream permission
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我遇到了同样的问题,但找不到任何示例代码。无论如何,我想出了这个,这对我有用。希望这对某人有帮助。
I had this same problem but couldn't find any sample code. Anyways, I came up with this, which works for me. Hope this helps someone.
您要查找的 API 方法是 Users.hasAppPermission。您可以直接从 JavaScript 调用它,但编写自己的 HTTP 方法可能会更有效,该方法通过 API 调用它并通过 JSON 返回“true”或“false”。
还有一个已提交的错误 (13378) Users.hasAppPermission 没有等效的 Graph API。
The API method you're looking for is Users.hasAppPermission. You could call it directly from JavaScript, but it will probably be more efficient to write your own HTTP method, that calls it via API and returns "true" or "false" via JSON.
There is also a filed bug (13378) that Users.hasAppPermission has no Graph API equivalent.
在新的 Graph API(包括通过 JavaScript)中,这可以通过访问“
/[user]/permissions
”来完成。来自用户对象文档:
权限
In the new Graph API (including via JavaScript) this can be accomplished by accessing "
/[user]/permissions
".From the User object documentation:
permissions
貌似不支持。至少没有记录。
不过,一旦获得许可,您就可以从 javascript 中读取内容。
Looks like is not supported. At least is not documented.
You may read from javascript once the permission is granted though.