Home > Mobile >  How create an Admin to manage users on two independent Firebase projects with a shared DB
How create an Admin to manage users on two independent Firebase projects with a shared DB

Time:12-21

Problem

I have two seperate apps, a "Manager" app and an "Employee" app which share a database, and I am using Firebase for auth. Currently I have two different projects in Firebase, one for each user type. I am now trying to develop a third "Admin" app that allows someone appointed by the organization to manage users on both the "Employee" and "Manager" apps. I have looked into using custom claims but in order for this to work across both apps would have to be on the same Firebase project.

Potential Solutions

  1. Migrate all users to the same Firebase project
    In this case, I migrate all of the users to one Firebase project and would assign a type to each user. Upon login, I would check if they are of the right type for that application and log them out if they are not - it's a bit hacky but workable

  2. Switch auth providers
    Obviously the most tedious and costly option that I would like to avoid if possible

Can anyone help me figure out the best approach here?

CodePudding user response:

Since all three apps seems to work within the same domain, it'd be most common to set them up in a single project and use custom claims, security rules, or a combination of both to control access of the various user types.

  • Related