gpt4 book ai didi

javascript - Facebook Graph API - 如何请求额外的权限

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:02:24 24 4
gpt4 key购买 nike

我正在使用 Facebook Javascript SDK 将用户登录到我的网站。这行得通,我可以在他们登录时请求权限。

但是,按照 Facebook 的建议,我只想在登录时请求最基本的权限,然后在需要时请求额外的权限,因为并非所有用户都需要,例如发布权限。

我的问题是我如何请求额外的权限?我在文档中看到的请求权限的唯一方法是在登录时执行。 This post建议再次调用 FB.login():

FB.login(function(response) {
// ...do some stuff
}, {
scope: ['publish_actions']
});

...但是这样做会给我一个错误:FB.login() called when user is already connected。大多数关于该主题的其他帖子只是说在登录时请求所有权限 - 但这违背了 FB 自己的建议。

Plan your app around requesting the bare minimum of read permissions at initial login and then any publish permissions when a person actually needs them

( From the FB Docs )

除了错误之外,调用 FB.login() 确实 似乎工作正常,但如果它明确导致错误,那么这肯定不是正确的方法去吧。我错过了什么吗?

最佳答案

您没有以正确的方式使用它:

FB.login(function(response) {
// handle the response
}, {
scope: 'publish_actions,some_other_permission',
auth_type: 'rerequest'
});

它不是一个数组,它只是一个字符串。您应该尝试使用 auth_type 参数。来源:https://developers.facebook.com/docs/facebook-login/login-flow-for-web/v2.3#re-asking-declined-permissions

关于javascript - Facebook Graph API - 如何请求额外的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30510684/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com