Reputation: 63
I'm busy building a meal delivery service using firebase. Now the service has multiple apps (customer app, driver app, restaurant app etc). Now I don't want customers to be able to log in to the restaurant panel, or to the driver app. How can I prevent this from happening?
Currently I have a collection in firebase for each type of user. What I tried to do first was allow the user to log in but it will only redirect to the restaurant admin panel if the email used is associated with a restaurant found in the restaurant collection. Otherwise they will be logged back out. But this solution doesn't seem to be working.
Upvotes: 0
Views: 41
Reputation: 7324
The way to do this is to implement role-based user authorization and security rules by adding custom claims to the Firebase Auth ID token.
Here are some resources to get you started:
https://www.youtube.com/watch?v=3hj_r_N0qMs
https://www.youtube.com/watch?v=1PEdd2rtG30
Upvotes: 2