'Why do I see a "400 (Bad Request)" in my developer console when sign-in to Firebase Authentication fails?

I'm using the method signInWithEmailAndPassword to validate a user in my angular based application, I wrote this code:

firebase.auth().signInWithEmailAndPassword(email, password).then(
    function(authData) {
      //user was validated
        console.log(authData);
    },
    function(error) {
        if(error){
            // Handle Errors
            var errorCode = error.code;
            var errorMessage = error.message;
            // [START_EXCLUDE]
            if (errorCode === 'auth/wrong-password') {
              alert('Wrong password.');
            } else {
              alert(errorMessage);
            }      
      }
    });

When I run this code with a valid user and password it works well, no errors in the console, but when I set an invalid user it throws a Bad Request in the console, and then it returns the corresponding error which is user inexistent. So it seems the validation is working fine but I wonder what this bad request means or what I'm missing in the code. This is the bad request message

POST https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key=AIzaSyDDCVDWgy9LGYLWmMPQjPZ49RbDkWjWVTk 400 (Bad Request) firebase.js:107

Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source