【发布时间】:2015-05-29 02:16:51
【问题描述】:
我想使用 AngularFire 从 Google OAuth 获取电子邮件地址,但在弹出窗口中,它并没有要求电子邮件权限。
这是来自Firebase Google auth doc的代码
var ref = new Firebase("https://<your-firebase>.firebaseio.com");
ref.authWithOAuthPopup("google", function(error, authData) { /* Your Code */ }, {
scope: "email"
});
它在我的 Angular 应用程序中有效,但我如何修复我的 Angular 代码来做同样的事情?
var ref = new Firebase("https://<your-firebase>.firebaseio.com");
var auth = $firebaseAuth(ref);
auth.$authWithOAuthPopup("google").then(function(authData) {
/* Code */
}).catch(function(error) {
console.error("Authentication failed:", error);
});
Link to the same problem with answer,但我没有得到答案以及如何解决它。
【问题讨论】:
-
也来自同一个文档,供参考:
authData.google.email包含 Google 用户在其个人资料中列出的主要电子邮件地址。仅当有效的电子邮件地址可用且用户授予 Google 电子邮件权限时才返回。
标签: javascript angularjs firebase angularfire