Facebook Graph API - 如何申请额外权限
Facebook Graph API - How to request additional permissions
我正在使用 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
除了错误之外,调用 FB.login()
does 似乎工作正常,但如果它明确导致错误,那么这肯定不是正确的方法它。我错过了什么吗?
您没有以正确的方式使用它:
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
我正在使用 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
除了错误之外,调用 FB.login()
does 似乎工作正常,但如果它明确导致错误,那么这肯定不是正确的方法它。我错过了什么吗?
您没有以正确的方式使用它:
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