Need to generate more friendly username when create account

Recently Nakama auto generates username like “df6YjkW”. I would like to create more friendly username base on my dictionary. How can I do that?

@Okno Nakama has always generated a username in the form of “df6YjkW” which have a low collision likelihood by default. If you want to have usernames generated which are more like the format “PlayerABC123” or similar you can use a before hook on authenticate to create your own username format for players by default.

Just keep in mind you’ll need to create a name generation space which minimizes the chance of collision or use some number of retries.

Hope this helps.

1 Like

Thank you for your answer. I need to ensure the name is unique. Maybe there is only way to do this is using database + before hook?

what is the meaning of “df6YjkW” ? is that some format string ?

@jell-o-fishi You can see the exact implementation for how default usernames are generated in code: