title: Firebase Authentication JavaScript get success
body: <p>With the following Firebase email authentication code, how do you know whether authentication was successful?</p>
  
  <pre><code>firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
              // Handle Errors here.
              var errorCode = error.code;
              var errorMessage = error.message;
  
              if (errorCode === 'auth/wrong-password') {
                alert('Wrong password.');
              } else {
                alert(errorMessage);         
              }
  
              console.log(error);
          });
  </code></pre>
  
  <p>I understand that it is easy to realise whether or not authentication was unsuccessful, however, how do I know if the user was able to login with their supplied credentials?  There doesn't seem to be a callback for a 'successful' log in.  I currently have a login form, and I want to navigate away on a successful log in.</p>