登录权限无效
Login Permission not working
- 我正在使用
Javascript SDK
脚本进行 FB
登录,我想通过此登录使用用户 public 自己的共享 post。
出于这个原因,我使用下面的 javascript
代码:
FB.login(function(response)
{
if (response.authResponse)
{
console.log('Welcome!');
}
else
{
console.log('User cancelled login');
}
}, {scope:'publish_stream'});
在上面的代码中我会给出 scope:'publish_stream'
但是当任何用户登录那个时候只获得关于 profile_info
的权限那么我不明白的问题是什么所以请帮助我
基本上我会给出 scope
所以当用户登录时必须询问但在我的情况下它的行为是不正常的我把图像放在用户登录权限页面的下面。
请指导我在代码中更改了什么,或者如果有任何其他方式也提供给我,谢谢
根据 Facebook developers page,这是实现方法:
FB.login(function(response) {
if (response.status === 'connected') {
// Logged into your app and Facebook.
} else if (response.status === 'not_authorized') {
// The person is logged into Facebook, but not your app.
} else {
// The person is not logged into Facebook, so we're not sure if
// they are logged into this app or not.
}
});
或者您可以通过以下方式检查登录状态:
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
更新 1: 在这里您可以看到一个 full list,其中包含您可以在范围内设置的所有权限。
您可以看到您需要使用 read_stream
而不是 publish_stream
我认为这是您的问题。
更新 2: 我找到了这个 (reference):
Facebook used to have a permission called publish_stream. publish_actions replaces it in all cases. This permission also replaces photo_upload.
因此您最好使用 publish_actions
而不是 publish_stream
,因为它现在已被弃用。
https://developers.facebook.com/docs/facebook-login/permissions/v2.0#reference-extended-publish
我希望这对你有进一步的帮助
- 我正在使用
Javascript SDK
脚本进行FB
登录,我想通过此登录使用用户 public 自己的共享 post。 出于这个原因,我使用下面的
javascript
代码:FB.login(function(response) { if (response.authResponse) { console.log('Welcome!'); } else { console.log('User cancelled login'); } }, {scope:'publish_stream'});
在上面的代码中我会给出
scope:'publish_stream'
但是当任何用户登录那个时候只获得关于profile_info
的权限那么我不明白的问题是什么所以请帮助我基本上我会给出
scope
所以当用户登录时必须询问但在我的情况下它的行为是不正常的我把图像放在用户登录权限页面的下面。请指导我在代码中更改了什么,或者如果有任何其他方式也提供给我,谢谢
根据 Facebook developers page,这是实现方法:
FB.login(function(response) {
if (response.status === 'connected') {
// Logged into your app and Facebook.
} else if (response.status === 'not_authorized') {
// The person is logged into Facebook, but not your app.
} else {
// The person is not logged into Facebook, so we're not sure if
// they are logged into this app or not.
}
});
或者您可以通过以下方式检查登录状态:
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
更新 1: 在这里您可以看到一个 full list,其中包含您可以在范围内设置的所有权限。
您可以看到您需要使用 read_stream
而不是 publish_stream
我认为这是您的问题。
更新 2: 我找到了这个 (reference):
Facebook used to have a permission called publish_stream. publish_actions replaces it in all cases. This permission also replaces photo_upload.
因此您最好使用 publish_actions
而不是 publish_stream
,因为它现在已被弃用。
https://developers.facebook.com/docs/facebook-login/permissions/v2.0#reference-extended-publish
我希望这对你有进一步的帮助