1

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.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
kstan
  • 11
  • 2
  • Open the "Network" tab of your devtools and try running it again. Do you see any requests failing with 400 or 500 level errors? If so, can you provide some more information about the error that you're seeing? – Michael Bleigh Jul 21 '16 at 20:19
  • Try the answer here: http://stackoverflow.com/questions/37764706/chrome-extension-auth-network-request-failed-when-communicating-with-firebase – The Dark Knight Jul 22 '16 at 13:39
  • I am too facing the same issue with email-password auth. Let me know if you have resolved it. – Anand Sep 18 '16 at 16:56
  • @TheDarkKnight - that answer is not for the same problem. This issue is for a generic javascrip app while the one you mentioned deals in chrome extension. – Anand Sep 18 '16 at 16:57

1 Answers1

0

If you haven't enabled user authentication on your google firebase account this code won't work, so please check if you have.

  • Thanks for the responses. Unfortunately that doesn't seem to be the problem. here is a short video on what it's doing. At the end of the video I call the CreateUser function and manually fill in the arguments, which works. http://recordit.co/H5V2x1a42M – kstan Jul 22 '16 at 21:02