Username not saving on account creation (Android, Auth API Client)

I am creating an account using the Authentication API Client on Android which works, but for some reason, the username never gets saved unless when signing in using Google or such, but never when creating a database user. Does anyone know how to fix this or perhaps a way to just manually set the username after the user has logged in? Thanks

AuthenticationAPIClient(account)
            .createUser(email, password, username, Auth0Constants.connection)
            .setConnection(Auth0Constants.connection)
            .start(callback)

Hi @taymaw,

Welcome to the Auth0 Community!

I understand that you are encountering a situation where the username is not saving on account creation.

First, could you please clarify whether you have enabled the Requires Username feature in your database connection? If not, please navigate to your Auth0 Dashboard database connections and switch on this feature. Please make sure to click Save.

Once you have enabled this feature, you can create users with a username and have that field saved in their user profile.

Having tested this myself, I was able to sign up a user using the Authentication API and verified that everything works as intended.

Please let me know if this resolves your issue.

Thanks, If I enabled this feature will I still be able to sign up users without a username? I have an app that is using the same database, and doesn’t require a username, but in the new one I want to be able to save a username. If I enable require username will that negatively impact the first app? Thanks

Hi @taymaw,

Unfortunately, if you disable the Requires Username feature, your users’ will not be able to sign up with a username. The Requires Username toggle is all-or-nothing.

Therefore, I recommend that you handle your use case by:

  1. Isolating your existing Database Connection that does not require a username.

  2. And then, creating a new Database Connection with the Requires Username feature enabled. Make sure that your application has only the new Database Connection enabled. That is, all other database connections are disabled except for the newly made Database Connection.

Doing so will avoid any conflict with your first application.

Please let me know if you have any further questions. I would be happy to help.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.

Hi team!

Updating this topic with our latest solution that makes it possible to create an account with flexible identifiers → Activate and Configure Attributes for Flexible Identifiers. You can select between Email, Phone, or Username as Identifiers for your database connection.

Thanks
Dawid