title: Firebase auth.$createUserWithEmailAndPassword not working
body: <p>I have been following a course on Firebase, but quickly discovered a lot of things have changed. <a href="https://www.firebase.com/docs/web/libraries/angular/api.html#angularfire-users-and-authentication-createusercredentials" rel="nofollow noreferrer">https://www.firebase.com/docs/web/libraries/angular/api.html#angularfire-users-and-authentication-createusercredentials</a>
  these docs are completely outdated.</p>
  
  <p>Here I declare my firebase variables</p>
  
  <pre><code>var ref = firebase.database().ref();
  var firebasedata = $firebaseObject(ref);
  var auth = $firebaseAuth();
  </code></pre>
  
  <p>Then I try to call this function </p>
  
  <pre><code>this.register = function() {
    auth.$createUserWithEmailAndPassword({
      email: this.user.email, 
      password: this.user.password
    }).then(function(regUser) {
      $log.log(regUser);
    }).catch(function(error) {
      $log.log(error);
    });
  };
  </code></pre>
  
  <p>But it throws this error: </p>
  
  <blockquote>
    <p>code
    :
    "auth/argument-error"
    message
    :
    "createUserWithEmailAndPassword failed: First argument "email" must be a valid string."</p>
  </blockquote>
  
  <p>I have searched for answers to this problem but all I can find is updating my angularfire or firebase (which are both the latest version) or that this.user.email is not a string. When I do a</p>
  
  <pre><code> console.log(this.user.email);
  </code></pre>
  
  <p>I can see it is a string containing a valid e-mail.</p>
  
  <p>Any help into the right direction would be welcome!</p>