title: Firebase Failed to load resource: the server responded with a status of 400 error
body: <p>I'm using Firebase to register a new user on the web platform,
  The registration works well and I can see the new user in Firebase console.</p>
  
  <p>But when I check some errors during the registration like duplicate mail for example, I get an error in the dev tools console: </p>
  
  <p><code>www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?key=.. iucensg Failed to load resource: the server responded with a status of 400 ()</code></p>
  
  <p>This is my code, hope you can help: </p>
  
  <pre><code> firebase.auth().createUserWithEmailAndPassword($scope.email, $scope.password).then((user) =&gt; {
  
              firebase.auth().currentUser.getToken(/* forceRefresh */ true).then(function (idToken) {
  
                  var providerID = user.providerData["0"].providerId;
  
                  $http({
                      method: 'POST',
                      url: url + '/userReg',
                      data: {
                          firstName: $scope.firstName,
                          lastName: $scope.lastName,
                          providerID
                      },
                      headers: {'x-auth': idToken},
                  }).then(function successCallback(response) {
  
                      if (response.status == 200) {
                          // $scope.$emit('logoutEvent', true);
                          $sessionStorage.put('ActiveUser', {accToken: idToken, providerID: 'email'});
                          $scope.$parent.logoutShow = true;
                          $scope.$parent.diaryShow = true;
                          $scope.$parent.userShow = true;
                          $scope.$parent.signInShow = false;
                          $scope.$parent.registerShow = false;
                          $window.location.href = '#/diary';
                      }
  
                  }, function errorCallback(response) {
                      console.log(response.data);
                  });
  
              }).catch(function (error) {
                  console.log(error);
              });
  
          }).catch(function (error) {
              $scope.alertShow = true;
              $scope.errorMessage = error.message;
          })
  </code></pre>