Create a user through another user with Firebase Authentication
I need to create an account, and from this account create other users who will have access to the same records as the main account database.
It should be taken into account that:
Ex:
const uid = 'CN1cY2LTzUYDbSgSX0WgAEmXTRp1'; // UID do usuário logado.
const collection = this.afs.collection(uid); // Referência da coleção onde terá os documentos.
const document = collection.doc('clientes'); // Retorno de todos os registros do documento.
I would like to create another user from this user, and this user will have access to the same documents from the main user collection.
But I will not be able to access from the UID of the logged in user because this UID will have a value other than the UID of the primary account that created this user, so at the time of doing the search it will not return any documents.
There are some parameters when creating a new user, some way that I can make whenever a user is authenticated, check if he is a user created from another user (main account), and if it is the reference to access the collection with the UID of the primary account?
Ex:
Collection: CN1cY2LTzUYDbSgSX0WgAEmXTRp1/configuracoes/usuarios
Documents: [ AMqCoDTNBzP7QAhnQYNiBGAK2XD2
, yyyC2FnGJ4RIaLIptNMUlzjGTl72
]
When authenticating with the user that the UID is AMqCoDTNBzP7QAhnQYNiBGAK2XD2
, you should reference it in the CN1cY2LTzUYDbSgSX0WgAEmXTRp1
collection.