Storing user data example - display name not showing in database
<p>A bit confused why there's no display name being displayed in my Firebase database, I've followed the steps in the example on their website and didn't get the expected result which they showed. Here's the example code.</p>

<pre><code>final Firebase ref = new Firebase("https://&lt;YOUR-FIREBASE-APP&gt;.firebaseio.com");
ref.authWithPassword("jenny@example.com", "correcthorsebatterystaple",
    new Firebase.AuthResultHandler() {
    @Override
    public void onAuthenticated(AuthData authData) {
        // Authentication just completed successfully :)
        Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
        map.put("provider", authData.getProvider());
        if(authData.getProviderData().containsKey("displayName")) {
            map.put("displayName", authData.getProviderData().get("displayName").toString());
        }
        ref.child("users").child(authData.getUid()).setValue(map);
    }
    @Override
    public void onAuthenticationError(FirebaseError error) {
        // Something went wrong :(
    }
});
</code></pre>

<p>Whenever I tried this example code the expected result was to be something similar to what is shown below.</p>

<pre><code>{
  "users": {
    "6d914336-d254-4fdb-8520-68b740e047e4": {
      "displayName": "alanisawesome",
      "provider": "password"
    },
    "002a448c-30c0-4b87-a16b-f70dfebe3386": {
      "displayName": "gracehop",
      "provider": "password"
    }
  }
}
</code></pre>

<p>Instead of showing something similar to the above, in my database only the provider is shown and not the displayName. Is there any necessary steps required to get the displayName to show or should it be there automatically?</p>

<p>I tried to look into this to see what was included within <code>authData.getProviderData()</code> and this was what was produced in the console when I printed it out.</p>

<pre><code>01-25 17:58:51.921 15651-15651/&lt;package-name&gt; I/System.out: {email=j.joe@hotmail.co.uk, isTemporaryPassword=false, profileImageURL=https://secure.gravatar.com/avatar/de53da9874178adb1a44b392ba5bed2f?d=retro}
</code></pre>

<p>So from the result produced it's left me wondering if the key "displayName" was formerly automatically created from the email and stored by default in <code>authData.getProviderData()</code> and that's why it is no longer shown.</p>

<p>Would appreciate it if someone could explain where the displayName in the database comes from because judging by the expected result it seems I've missed something. </p>

<p>Thanks!</p>