Mends.One

Account specific firebase

Firebase Security, Firebase, Authentication

We've got a number of apps which can be classified into about 3 categories. The user data for each category is very similar but between each category quite different. So we're thinking we should create 3 different firebases, one to store the data for each category of app. However we'd like to implement a common account system since our users may use individual apps from any or all of the 3 categories. So ideally the user creates an account once & then just logs in using that same account going forward on any of our apps.

Therefore my question is would it make sense to create a 4th firebase that only manages user accounts with the actual table data including permissions for any particular app (ie subscriptions, purchases, etc)? At that point could we use the authentication token that would be returned when the user logs in to this 4 firebase to make requests to any one of the 3 other firebases?

0
F
felix5
Jump to: Answer 1

Answers (1)

If you are using Firebase Simple login, then login credentials will be tied to a single Firebase. However, if you are generating your own custom tokens, you can certainly share the same login credentials across multiple Firebases (you have complete control over how those tokens are generated).

The documentation for creating custom tokens is here: https://www.firebase.com/docs/security/custom-login.html

In regards to whether or not you should be using 4 separate Firebases: each Firebase has a unique set of Secrets that can be used to generate authentication tokens, and it has a single set of Security Rules. As a result, it usually works best if a single Firebase is tied to a single app (a single code base). However, you can feel free to structure this however you like. If it's more convenient to share 1 Firebase across multiple apps, there's really no reason this won't work for you. You could, for instance, store data for your first app, at /app1, data for your second app at /app2, etc. Just keep in mind that those apps will end up sharing single security rules file, a single set of secrets, a single set of settings, and single set of stats / analytics.

2
A
Andrew Lee

Comments:

Andrew Lee said:
If you're wondering about Firebase Simple Login -- there isn't an automated way to export credentials yet, but you can email us and we can get that for you.

Related Questions