/    Sign up×
Community /Pin to ProfileBookmark

How to create different two different users database in firebase

I have a project that has two applications. A react native user app and an admin website were created using React JS. Both apps should use the same database, which can easily be done in firebase. Now I want to build an Authentication for both apps. But if you register in one app (eg. user app) you should not have an account in the admin app. So I don’t know how to handle this problem in Firebase because all apps in one project build on the same Authentication-System. What is the best way to handle this problem?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMar 11.2022 — A: I know nothing about Firebase. :)

B: Typically I use one user database table, but have a column that indicates the type of user. Then various pages that require "admin" access can check that the user has that privilege (either by including that value in the server-side session data, or via an on-demand DB query, whichever makes more sense in your case).
Copy linkTweet thisAlerts:
@HereturbiesWaltauthorMar 14.2022 — Unless the structure of the user data is vastly different (e.g. seller info vs buyer info) I would just stick them into one collection and use flags. You should paginate the data properly anyways and not just read the entire collection in one go. Filtering is also pretty fast.
Copy linkTweet thisAlerts:
@TuqueroIMKJernalynMar 21.2022 — Firebase doesn't have types of users, so that knowledge will have to come from your application logic and will typically exist either in the database (in a section that regular users can read, but not modify) or in a custom claim that you set from a trusted environment).
Copy linkTweet thisAlerts:
@JimWickAug 08.2022 — Firebase doesn't have types of users, so that knowledge will have to come from your application logic and will typically exist either in the database (in a section that regular users can read, but not modify) or in a custom claim that you set from a trusted environment).
×

Success!

Help @HereturbiesWalt spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...