为什么我的Google身份验证不能在Firebase中工作?
Why doesn't my Google authentication work in Firebase?
我在Firebase提供的示例http://jsfiddle.net/firebase/a221m6pb/后建模了我的Google登录
然而,当我运行我的代码(https://firetest-wadeziegler.c9.io/logon),弹出选择用户后变成空白,永远不会关闭。回调代码永远不会执行。知道为什么不行吗?
OAuth重定向授权域:
firetest-wadeziegler.c9.io
logon.js
function logonWithGoogle() {
var promise = session.logonWithGoogle();
$.when(promise)
.then(function (authData) {
setTimeout(function() { window.location.replace('/') }, 0);
}, function (error) {
showMessageBox('Logon Failed', error);
});
}
session.js var session = new session ();
function Session() {
this.firebase = new Firebase("https://glowing-inferno-3026.firebaseio.com");
this.firebase.onAuth(function globalOnAuth(authData) { } );
}
Session.prototype.isLoggedOn = function() {
return this.firebase.getAuth() != null;
}
// Returns Promise object
Session.prototype.logonWithGoogle = function() {
var deferred = $.Deferred();
this.firebase.authWithOAuthPopup("google",
function (err, user) {
if (err) {
deferred.reject(err);
}
if (user) {
deferred.resolve(user);
}
}
, {
remember: "sessionOnly",
scope: "email,profile"
});
return deferred.promise();
}
问题在于调用代码和表单中单击缺少preventDefault()
。页面重新加载后,点击,但它是如此之快,我没有注意到。愚蠢的错误。
<button onClick="logonWithGoogle(); return false /* prevent submit */">
相关文章:
- Javascript:selenium Web驱动程序isDisplayed()不工作
- jQuery UI自动完成突然停止工作
- AngularJS UI路由器不能像ng路由器那样工作
- HTML5音频加载和播放获胜'我不能在iPad上工作
- Firebase迁移-简单的Firebase.set没有'不再工作了——旧的还是新的
- AngularJS Firebase注销用户不工作
- firebase登录与离子不工作
- Firebase推送通知-节点工作程序
- 带有Firebase的Cordova将无法正常工作
- Firebase limitToFirst 无法按预期工作
- Firebase存储getDownloadURL()不返回工作url
- Firebase push不能在value事件中工作
- 我试图上传一个图像到firebase,但代码似乎不工作
- 无法使child_added上的firebase工作
- 灰烬在Firebase主机不能正常工作
- 我的代码不工作.如何删除Firebase列表中的元素?
- 当直接链接时,AngularJS路由不工作——使用html5模式和Firebase重写
- 为什么我的Google身份验证不能在Firebase中工作?
- getDownloadURL无法正常工作-Firebase存储(Web)
- AngularFire -嵌套的Firebase请求不能工作