Auth0 Home Blog Docs

How to create new user with user_metadata properties?



I’m trying to signup a new user on an Android device. I have a form with four fields like first_name, last_name, email, password. I already looked at the Android quickstart ( and I’m using the following code:

authenticationClient.createUser(email, password, "", "Username-Password-Authentication").start(callback)

I do not see possibility to pass the custom parameters like first_name and last_name in your Android SDK, but in API documentation I see you have such possibility:

In iOS sdk you can also call createUser with userMetadata but on the Android SDK is not possible to do this:


      username: nil, 
      password: dataModel.password, 
      connection: "Username-Password-Authentication", 
           "given_name": dataModel.firstName, 
           "family_name": dataModel.lastName 
) .start ...

Am I missing something?


Assuming a correctly configured authentication client is available in the client variable you should be able to do the following in order to create the user with additional user_metadata properties:

// Define your custom fields
Map<String, Object> metadata = new HashMap<>();
metadata.put("language", "pt");

// Define the additional parameters, adding the user_metadata
Map<String, Object> params = new HashMap<>();
params.put("user_metadata", metadata);

  .createUser("", "secret", "db-connection-name")
  .start(new BaseCallback<DatabaseUser, AuthenticationException>() {
      public void onSuccess(DatabaseUser user) {
        // ...

      public void onFailure(AuthenticationException error) {
        // ...