When I run my code to create a user I get this error code error code: auth/network-request-failed
and this error message
error code: auth/network-request-failed
I have this html input field for accepting the email address and password
<form>
<input id="email" type='text' name="email" placeholder="email">
<input id="password" type='text' name="password" placeholder="password">
<button id="create-user" >create user</button>
</form>
I have the following jquery code to pass the information to firebase
$("#create-user").on("click", function () {
console.log("create user");
var email = $("#email").val();
var password = $("#password").val();
createUser(email, password);
});
var createUser = function (email, password) {
firebase.auth().createUserWithEmailAndPassword(email, password).catch(function (error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
console.log("error code: " + errorCode);
console.log("error message: " + errorMessage);
});
};
If I call the createUser function from the console, it works as expected, but using the click function creates the error for some reason.