The Nashvillean
The Nashvillean

Reputation: 11

Building two (Client/Admin) apps on one firebase authentication

We have two apps, one for the client and one for the admin (similar to Uber's user and driver apps). In both apps, when users attempt to authenticate, cloud functions triggers a new user creation and it saves a document in users' collection in cloud firestore with some data, like phone number, email, etc. We are encountering a an issue that when the user or the "driver" registers, the data model that is saved in the cloud firestore has different fields and they are different from one another.

When a new user is registering, how can I trigger in the cloud function that can identify whether it is from the "user" or the "drive" app?

Upvotes: 1

Views: 815

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317710

There's not going to be anything in the Cloud Functions auth trigger that tells you which app registered the new user. Within a Firebase project, all user accounts are effectively shared between all apps, and all users will have the same permissions between those apps.

If users slot into different categories based on the app they used to sign up, you'll have to create that distinction on your own, perhaps with something you write to a database. If this isn't acceptable from a security perspective, you should use two different projects instead to keep everything separate.

Upvotes: 1

Related Questions