title: How do you include a username when storing email and password using Firebase (BaaS) in an Android app?
body: <p>The Firebase <code>createUser()</code> method takes an email and password field, but what if I want to also allow the user a custom username similar to Snapchat, Instagram, StackOverflow etc? Is there any way to modify the existing method to accept that field as well or do I need to do push and manage this info manually and if so how? </p>
  
  <p>This is my first attempt at storing the desired user info:</p>
  
  <pre><code>Firebase ref = new Firebase(firebaseURL);
  ref.createUser(email, password, new Firebase.ValueResultHandler&lt;Map&lt;String, Object&gt;&gt;() {
  @Override
  public void onSuccess(Map&lt;String, Object&gt; result) {
  System.out.println("Successfully created user account with uid: " + result.get("uid"));
  
  //Sign user in
  Firebase ref = new Firebase(firebaseURL);
  ref.authWithPassword(email, password, new Firebase.AuthResultHandler() {
  
  @Override
  public void onAuthenticated(AuthData authData) {
  System.out.println("User ID: " + authData.getUid() + ", Provider: " + authData.getProvider());
  
  //Save user info
  Firebase userRef = new Firebase(firebaseURL + "Users/");
  User user = new User(username, authData.getUid());
  userRef.setValue(user);
  </code></pre>
  
  <p>Is this good practice? I figured storing the UID with the username may help me in the future handling changes etc. Also, should I be implementing the <code>updateChildren()</code> or <code>push()</code> method so the entries do not get overwritten if this is a social media app? </p>
  
  <p>This is my second attempt:</p>
  
  <pre><code>  @Override
    public void onAuthenticated(AuthData authData) {
    System.out.println("User ID: " + authData.getUid() + ", Provider: " + authData.getProvider());
  
    //Save user info and username
    Firebase ref = new Firebase(firebaseURL);
    Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
    map.put("email", email);
    map.put("username", username);
    map.put("provider", authData.getProvider());
  
    ref.child("users").child(authData.getUid()).setValue(map);
  </code></pre>