Angular + Facebook JS SDK登录:不要求我的权限 [英] Angular + Facebook JS SDK login: Not requesting my permissions

查看:131
本文介绍了Angular + Facebook JS SDK登录:不要求我的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

FB.login()不工作。 FB Popup没有请求正确的权限。我可以清楚地看到,在源代码中有一个fn处理程序使用正确的参数/参数设置。我想明白为什么这不工作?

FB.login() is not working. The FB Popup is not requesting the right permissions. I can clearly see, in the source code that there's a fn handler that uses the right parameters / parameters being set correctly. I'd like to understand why isn't this working ?

这是迄今为止的代码:

http://jsbin.com/IteY/1/

这是我正在设置权限列表:

This is where I'm setting the permissions list:

facebook.login(function(response) {
    console.log(response);
}, {scope: 'email,user_likes'});

根据文档( https://developers.facebook.com/docs/reference/javascript/FB.login/

通过在login()的fn处理程序中做console.log,我得到fn函数(响应){...}和{scope:'email,user_likes'}

by doing console.log in the fn handler for login(), I get the fn function(response){ ... } and the {scope: 'email,user_likes'}

我发现一些其他用户在SO中使用FB SDK报告相同的问题。我尝试使用perms而不是scope,但是我得到:

I found some other users reporting the same issue using the FB SDK here in SO. I tried the tip to use "perms" instead of "scope", but I get:

OAuth2规范表示'perms'现在应该被称为'scope'。请更新。

OAuth2 specification states that 'perms' should now be called 'scope'. Please update.


  • 看起来不是问题。这也表明param正在发送。想知道为什么不工作?我已经清理缓存

  • Not appearing to be the problem. This also shows that the param is being send there. Go wonder why's not working ?! I've cleaned cache too

本来我已经报告了这个问题( AngularJS:DI错误 - 没有模块:$ facebook,为什么不工作?现在可以访问FB对象,我无法从用户那里获取正确的权限。我确信这是与Facebook API相关的问题,而不是Angular模块。

Originally I've reported this issue (AngularJS: DI Error - No module: $facebook, why isn't working?) that was solved. Now having access to the FB object I'm not able to get the right permissions from the user. I'm sure that this is an issue related with Facebook API and not the Angular module

****我我也试图通过使用.api来检查权限,如:

**** I've also tried to check the permissions by using .api like :

facebook.api('/me/permissions', function (response) {
    console.log(response);
} );

console.log报告:

console.log reports:

对象{error:Object}

Object {error: Object}

*****现在我尝试使用access_token访问图表:

***** Now I've tried to access through the graph using the access_token:

https://graph.facebook.com/me/permissions?access_token= XXXXXXXX

我可以看到正确的权限,但Facebook登录弹出窗口从来没有问过我们? 不应该吗?

and I can see the right permissions, but the Facebook login popup never asked me about them ? Shouldn't it ?

  {
     "data": [
        {
           "installed": 1,
           "basic_info": 1,
           "email": 1,
           "read_friendlists": 1,
           "user_likes": 1,
           "user_online_presence": 1,
           "user_friends": 1
        }
     ],
     "paging": {
        "next": "xxxxxxx"
     }
  }

我现在问了一个不同的用户,谁我已经添加到我的沙箱作为管理员,他获得了所需的权限弹出!所以,我认为是要做的,用我自己的用户名谁拥有这个权限已经设置或某事 - 即使我试图删除缓存等!

I've now asked a different user, who I've added to my sandbox as an admin and he got the required permissions popup! So, I think is something to do, with my own username who had this permissions already set or something - even though I tried to delete the cache, etc!

所以,没有问题要解决。希望这对未来的其他人有用!

So, there's no issue to solve. Hope this is useful for someone else in the future!

有经验的人可以看看吗?

Any one experienced can take a look ?

谢谢

推荐答案

尝试将一个监听器附加到facebook登录事件/ statuschange:

Try attaching a listener to the facebook login event / statuschange:

$facebookProvider.Event.subscribe('auth.authResponseChange', function (response) {
    console.log(response);
})

查看响应元素,看看是否有错误

And look at the response element to see if you have an error or not

这篇关于Angular + Facebook JS SDK登录:不要求我的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆