2

I am new to Firebase. I want to create a new user in Firebase with Username, Email and Password. I am trying to create it using Firebase's createUser() method. How can i add Username while create a new user, Here is the code I am using.

mFirebaseRef.createUser(Email, Password, new Firebase.ValueResultHandler<java.util.Map<String, Object>>() {
                    public void onSuccess(java.util.Map result) {
                        System.out.println("Successfully created user account with uid: " + result.get("uid"));
                    }
                    public void onError(com.firebase.client.FirebaseError firebaseError) {
                        System.err.println("Error while creating user " + firebaseError);
                    }
                });

Using this code can create a user. I can see the user email which i used for signup.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
SHIDHIN TS
  • 1,557
  • 3
  • 26
  • 58
  • You seem to be using the legacy Firebase SDK. An email+password user there, literally consists of those two pieces of information: an email address and a password. You'll have to keep the additional properties elsewhere, such as in the Firebase Database. See http://stackoverflow.com/questions/37415863/firebase-setting-additional-user-properties – Frank van Puffelen Jul 15 '16 at 15:04

1 Answers1

1

To add a username, you can call updateProfile in the FirebaseUser class by passing in a UserProfileChangeRequest.Builder. There you can setDisplayName.

Bill
  • 4,506
  • 2
  • 18
  • 29