0

I am creating a child tracking flutter app in which I have to register a child account in firebase from parent account but every time I register a child, parent got logged out and that new added child got logged in to parent app.

Zee
  • 1
  • 1

1 Answers1

0

I would question whether adding a child to a parent is the same as registering a new account? It would possibly make it easier to separate the idea of users with the idea of parents and children.

Rather than having a relationship like user (parent) <->> user (child).

I think I would have a new entity like person which could be a parent and have another person as a child.

But then have the ability to connect a person to a user.

That way, when a parent adds a child to themselves they are not creating a new user account. They are merely adding a new person (which would not have a user account attached to it).

If you want children to log in also then you could have the parent provide an ID to the child. Or create an email address on the child etc... That way the child could log in at a later time and connect their user account to the relevant person document.

Fogmeister
  • 76,236
  • 42
  • 207
  • 306
  • Its a requirement to register child from parent side :( – Zee Aug 03 '21 at 13:52
  • You can still register a child. Just separate the logic of registering a child from connecting a user account to it. Also... just seen this... https://stackoverflow.com/questions/60536146/how-to-only-allow-current-users-to-create-accounts-for-new-users-in-firebase You cannot do what you are trying to do from the app. You would have to create a cloud function to use the admin sdk and create additional users for you. – Fogmeister Aug 03 '21 at 13:53