Duplicate check for "display_name" or "username"

Hi,

Is there a tutorial on how to make sure that each user registering on my app has a unique username? Currently I am using Firebase auth and Gmail+Email to register users. Gmail is able to provide display_name but when user registeres via email, display_name is blank.

When user registers using Gmail, it allows two users to have same display_name. Secondly, I am planning to create a feature for users to be able to create a display_name if they register via email.

But I am stuck at a point where I don;t know how to check if username users are creating are a duplicate or not. Any help around this is appreciated.

1 reply