[英]“A network error has occurred” error on email/password sign up with Firebase
I'm following the setup for email/password sign up that Firebase has specified in their official documentation; 我正在按照Firebase在其官方文档中指定的电子邮件/密码注册设置进行操作; however, I keep getting "a network error has occurred" error when proceeding with authentication.
但是,在继续进行身份验证时,我一直收到“发生网络错误”错误。
Authentication code: 验证码:
window.onload = function() {
const config = {
apiKey: "",
authDomain: "",
databaseURL: "",
storageBucket: "",
messagingSenderId: ""
};
firebase.initializeApp(config);
const btnSignUp = document.getElementById('btnSignUp');
btnSignUp.addEventListener('click', function() {
const inputEmail = document.getElementById('username-input');
const inputPassword = document.getElementById('password-input');
const email = inputEmail.value;
const password = inputPassword.value;
firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
console.log(error);
});
});
};
Console errors: 控制台错误:
A network error (such as timeout, interrupted connection or unreachable host) has occurred.
All set - the problem was the 'type' attribute in the button was not defined and was defaulted to a submit type. 全部设置-问题是按钮中的'type'属性未定义,并且默认为提交类型。 By setting type="button", the issue was resolved.
通过设置type =“ button”,此问题已解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.