Search code examples
androidfirebasefirebase-authenticationfirebase-console

How to add user details to firebase auth table?


In Manage Users in Firebase , you can see there are methods such as user.getDisplayName(), or user.getPhotoUrl(), But in my table of authenticated users there aren't any of these:

enter image description here

My question is, are these methods built-in in Firebase, and I need to change my auth code to have these columns in the table? Or, these are only pseudu-code methods that I need to implement by having the rest of the user's details, such as profile image, and name in Firebase Storage and Firebase Database?


Solution

  • That's a nice question. I also had the same question when I was new to firebase-authentication. You can not see those columns in that table but still, you are able to store those meta-data to that table(hidden in that table). At first, you have to create a UserProfileChangeRequest object and populate it with your data like this :

    UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
                .setDisplayName("ADD_A_DISPLAY_NAME_HERE")
                .setPhotoUri(Uri.parse("ADD_PROFILE_PHOTO_URL_HERE"))
                .build();
    

    Next, update user profile using the same object you populated like this :

    FirebaseAuth.getInstance().getCurrentUser().updateProfile(profileUpdates);
    

    Try this and let us know if it worked or not.