gpt4 book ai didi

javascript - "A network error has occurred"电子邮件/密码注册 Firebase 时出错

转载 作者:行者123 更新时间:2023-11-30 08:29:05 25 4
gpt4 key购买 nike

我正在按照 Firebase 在其官方文档中指定的电子邮件/密码注册设置进行操作;但是,在进行身份验证时,我不断收到“发生网络错误”的错误消息。

验证码:

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);
});
});
};

控制台错误:

A network error (such as timeout, interrupted connection or unreachable host) has occurred.

最佳答案

全部设置 - 问题是按钮中的“类型”属性未定义,默认为提交类型。通过设置 type="button",问题得到解决。

关于javascript - "A network error has occurred"电子邮件/密码注册 Firebase 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40662537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com