[Firebase] How to Check if a Username already exists?


I have this structure in the firebase database:
Note: Nome=Username

I need to check, before the registration, if a Username (“Nome”) already exists!

How can be done?

Thank you.

You have a security problem.

The way you have it structured the entire databbase needs to be downloaded to check if a tag is there.

Not a good idea.

What are these Character tags here?


Hi @cian:

Utilizadores = Users “table”
______+ UID (e.g.: WR0BxV5BT4Tz7UpKeGMyJf8HV7y1)
_____________ Name: Username

The Username (“Nome”) is stored this way:

It will be very difficult but not impossible.
If you want to get only one nome (name) then you have to use ’ for each items in the list ’ block.
Lets open more.
Store a empty list to a global variable.
1.Set project bucket empty.Then call get tag list.
2.When tag list got then do ‘for each items in list’ set project bucket to get item.Then once again call get tag list.
3.Repeat step-2.Now get value tag=Nome (Name).
4.When got value then add items to the list = get value.
5.Now check if textbox text is in list?list=global list
If you find hard to do it then I will add screenshots to it.

1 Like

So you want to make sure there is no conflict between username in a UID and a new user?

The other way to do it is to create a second list of all the usernames. That way you are asking for a tag, and if it is not there then you know it is valid. if it is there, you can throw up an exception

Otherwise like @vknow360 said, you need to parse the entire database. Security issue for sure.

Thank you for the help guys!

@cian, are you talking about something like this?

Yes. However I would put a value of 1 with each tag.

Then you do a get tag Bucket/Names/James

If value = 1 then name used.

That way you are only getting one tag,


I got it!

Thank you so much for help!


Just one last think!

This way, because the “Name” is inside a UID tag an also inside a “Names” tag, when edited or removed, it must be set in the 2 places:
/Names: James
/UID/Name: James


1 Like