I'm following the setup for email/password sign up that Firebase has specified in their official documentation; 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.
I'm following the setup for email/password sign up that Firebase has specified in their official documentation; 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.
Share
Improve this question
edited Nov 17, 2016 at 20:42
Frank van Puffelen
601k85 gold badges890 silver badges860 bronze badges
asked Nov 17, 2016 at 18:35
NovoNovo
2012 silver badges9 bronze badges
1
- Please provide more information on the environment you are using. Can you also check your network log. Is the request going out? That should help explain things. – bojeil Commented Nov 18, 2016 at 20:38
1 Answer
Reset to default 6All set - the problem was the 'type' attribute in the button was not defined and was defaulted to a submit type. By setting type="button", the issue was resolved.