与Facebook不recieving扩展权限Angularfire登录 [英] Angularfire login with Facebook not recieving extended permissions

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

问题描述

我有这个升级到0.9 angularfire前工作完美

我要请求从Facebook 用户的电子邮件地址。 Facebook已经授予允许我从我的用户询问此。我使用下面的code与Facebook登录。这一切能够完美承认,它不要求用户的电子邮件。

FYI:我使用的是Angularfire种子codeBase的

  loginWithFacebook:功能(){
      返回AUTH。$ authWithOAuthPopup(脸谱,功能(错误的authData){/ *您code * /},{
        记住:sessionOnly
        适用范围:电子邮件,user_likes
      });
    },

在此先感谢!


根据下文小李的回答,我已经注意到,功能不会运行在所有。不知道问题是什么。

  REF VAR =新火力地堡(https://开头<您-火力> .firebaseio.com);
参考$ authWithOAuthPopup(脸谱,功能(错误的authData){   //这个code从不RUNS   如果(错误){
      的console.log(登录失败!,错误);
   }其他{
      的console.log(成功地与有效载荷验证:,的authData);
   }
});


解决方案

$ authWithOAuthPopup需要的选项。

这也是最好的执行它根据文档的例子:

  $ scope.authObj $ authWithOAuthPopup(脸谱,{记住:sessionOnly,适用范围:电子邮件,user_friends})。然后(功能(的authData){
    的console.log(作为登录,authData.uid);
})赶上(功能(错误){
  console.error(验证失败,错误);
});

I had this working perfectly before upgrading to angularfire 0.9

I want to request the user's email address from facebook. Facebook has already granted me permission to ask for this from my users. I am using the code below to login with facebook. It all works perfectly accept that it doesn't request the user's email.

FYI: I am using the Angularfire-seed codebase

loginWithFacebook: function() {
      return auth.$authWithOAuthPopup("facebook", function(error, authData) { /* Your Code */ }, {
        remember: "sessionOnly",
        scope: "email, user_likes"
      });
    },

thanks in advance!


In response to Mike's answer below, i've noticed that the function does not run at all. not sure what the issue is.

var ref = new Firebase("https://<your-firebase>.firebaseio.com");
ref.$authWithOAuthPopup("facebook", function(error, authData) {

   //THIS CODE NEVER RUNS

   if (error) {
      console.log("Login Failed!", error);
   } else {
      console.log("Authenticated successfully with payload:", authData);
   }
});

解决方案

$authWithOAuthPopup takes options.

It is also best to execute it as per the documentation example:

$scope.authObj.$authWithOAuthPopup("facebook",{remember: "sessionOnly",scope: "email,user_friends"}).then(function(authData) {
    console.log("Logged in as:", authData.uid);
}).catch(function(error) {
  console.error("Authentication failed:", error);
});

这篇关于与Facebook不recieving扩展权限Angularfire登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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