DEV Community

Fernando B πŸš€
Fernando B πŸš€

Posted on

Firebase NOSql Parent-Child logins

I am in the process of designing a chore app where parents can assign chores, give allowances, rewards for meeting XP points, etc, and the child can keep track of those chores, and how much money they haved saved/spent. Also child can make specific saving goals like a toy or videogame, and put chore money towards those goals.

Anyways I am a bit stuck with the login/creation user in terms of the database side I am using firebase. My original idea was to have one parent be the initial admin, and then he/she can create the other parent and child accounts and share a secret generated code with QR. The other non admin users would be able to login with admins email, and QR code. Only problem with that is that non admin users might not show up in the users database in firebase.

The reason why I wanted to use admin/QR code for children accounts is that some children do not have email accounts yet, or are too forgetful for passwords.

  • Would multiple accounts per email be a better?
  • Are there other methods of dealing with parent/child apps logins?

Top comments (6)

Collapse
 
drishit96 profile image
Drishit Mitra

You can create new users without the need to link them with an email address or phone number using the firebase admin sdk.

Check the docs here: firebase.google.com/docs/auth/admi...

Collapse
 
thefern profile image
Fernando B πŸš€

Thanks for the docs link. Maybe I missed something but going through that page the createUser still requires email which is what I'm trying to avoid for children accounts.

Collapse
 
drishit96 profile image
Drishit Mitra • Edited

Read the note in blue...it says all the parameters including the email address is optional

Thread Thread
 
thefern profile image
Fernando B πŸš€

Got it, will give that a try. Early morning lol I missed the blue note.

Collapse
 
atf98 profile image
ATF98

I worked with Firebase the last project I did, we had the same situation as yours, not specifically but similar, It was a hospital system, where each nurse have a user in the system, they can change things and update, add, remove, etc. but before anything there is the Supervisor he is one of the nurses but he has a higher level where all the request of modifying in the database goes to him and he should accept or decline them
however I don't remember we use the Firebase Authentication, cuz it would be hard doing it use it. I remember we build the whole thing from scratch.
I know this is stupid but we build the supervisor as nodes, where it has leaves, those leaves represent the nurses and one of them has the higher level, by doing this we give the higher nodes all the permissions and no one can access them only the Supervisor ( the responsible nurse )
What we did is converting the NoSql to SQL by building it on NoSql database ( if that make any sense ) lol, ik now you asking why working with NoSql and then build the Schema as SQL, simple we needed a Real-time Database, and Firebase was the best choice to start with
It was really challenging but in the end, we figured it out

Collapse
 
thefern profile image
Fernando B πŸš€

Thanks for the response. I think you set me on the right track. Yeah looks like I won't be able to use firebase auth which was what I was trying to avoid but I don't really want to make it hard for children to create their own accounts, I'll have to create a user schema as you did, I guess the correct term is role based user permissions.