Firebase v3 createUserWithEmailAndPassword .then Promise
<p><a href="https://firebase.google.com/docs/reference/js/firebase.auth.Auth#createUserWithEmailAndPassword" rel="noreferrer">Firebase v3 Reference Guide</a> indicates that <code>createUserWithEmailAndPassword(email, password)</code> returns <code>firebase.Promise</code> containing non-null <code>firebase.User</code>.</p>

<p>The Firebase v3 <a href="https://firebase.google.com/docs/auth/web/password-auth" rel="noreferrer">Authenticate with Firebase using Password-Based Accounts Guide</a> shows the following example</p>

<pre><code>firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
  // Handle Errors here.
  var errorCode = error.code;
  var errorMessage = error.message;
  // ...
});
</code></pre>

<p>My question is, I want to fire a function which adds the user to my <code>users</code> node in my Realtime Database.  I want to include the users display name that I collected from the sites registration form.  So, it seems like I want to do a <code>.then</code> and if the <code>createUserWithEmailAndPassword</code> method was successful I want to fire a function that writes the new user (with display name) to my Realtime Database <code>users</code> node.</p>

<p>How do I modify the example script to a <code>.then</code> style?</p>