I have an React app where each user belongs to a company. The first person in that company is the manager, who can invite other users. They'll get an email link to sign up.
How do I attach the companyId (or another piece of info to connect them) to the invite so that when a new user is invited and authenticated this person is added to the company?
I tought of 2 possible solutions.
- Adding an invitedEmail array to the company collection and run a cloud function to check if a new users email belongs to the company.
- Add somewhere the id of the company in the invite and get this id while new user signs up. But don't know where or how.