簡體   English   中英

使用Firebase注冊電子郵件/密碼時出現“網絡錯誤”錯誤

[英]“A network error has occurred” error on email/password sign up with Firebase

我正在按照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'屬性未定義,並且默認為提交類型。 通過設置type =“ button”,此問題已解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM