使用 Facebook 的 Angularfire 登录未获得扩展权限 [英] Angularfire login with Facebook not recieving extended permissions
问题描述
在升级到 angularfire 0.9 之前,我让这个工作完美
I had this working perfectly before upgrading to angularfire 0.9
我想从 facebook 请求用户的电子邮件地址.Facebook 已经允许我向我的用户提出这个要求.我正在使用下面的代码登录 facebook.一切都完美地接受它不要求用户的电子邮件.
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.
仅供参考:我正在使用 Angularfire-seed 代码库
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"
});
},
提前致谢!
为了回应下面 Mike 的回答,我注意到该函数根本没有运行.不确定是什么问题.
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 接受选项.
$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 的 Angularfire 登录未获得扩展权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!