Multiple Authentication Firebase? - firebase

I am trying to figure out a problem I currently have. I have a software platform where restaurant owners can make and publish their own mobile apps. Menu access, reservation control, etc etc. I am using Firebase as my backend.
For each restaurant app I make, requires a customer login. The problem is that the customer can download another app from my restaurant client and has the ability to log in with the same credentials because I am using the same Firebase project for multiple apps, under the same company.
This is not what I want.. can I make multiple instances of Firebase Authentication? Or when the user registers, do I hardcode the username and password into the database, and check that, upon registration and signing in? If I did that, I would lose the power of third party log ins.
Please let me know of any ideas you guys might have..
Thanks!
Jorge

Firebase Auth can't have multiple instances per project. You would need to create multiple projects to in order to get more instances.
However, what you're talking about could be called "multi-tenancy", where you have multiple organizations each sandboxed from each other in a single project. For that, you will need to adopt Google Cloud Identity Platform and work with it using the Firebase APIs as described by the documentation.

Related

Use Firebase Auth data and users for multiple projects and apps

If I have multiple apps with Firebase (different types and kinds) but want to be able to have 1 user base for all of them (1 account for all apps, even if they only use 1) how would I do this? I was thinking either 1. cloud function (every time someone signs up, add them as a user in the other apps) or 2. A separate project for Auth only and configure both of them in the app, but that might mean requests to firestore, storage, and functions aren’t authorized. NOTE: I'm willing to use GCP products separate from firebase to accomplish this.
If the apps are all part of the same suite, you can add them to a single Firebase project. This is by far the easiest way to do this, but there is a hard limit on how many apps you can have in a project in this way (according to the FAQ, this is 30 at the moment).
If the apps are not all part of the same suite, or you need more than the limit, your only option is to use custom authentication. This means you'll create a custom authentication provider that takes the user's credentials, verifies them, and then creates a UID and token for that user to the client which then uses it to sign in to Firebase.
In the back-end you could possible use a single Firebase project for then generating all these users, although I'll admit it's been a few years since I did that.

Customer specific Firebase storage

I have an Flutter app that use Firebase as backend. Initially, a Firebase project and a collection is created to store data from different customers using the app. A key field "Customer" is use to separate the data among different users in the big pool.
In order to enhance the security and customise the billing incure in Firebase, I would like to separate different customer with their own Firebase account/project/database setup, the process is:
Whenever a new customer install the app and run it at the first time, the app will ask the customer to create his/her firebase account and then pass the account information to the app. Then, the app can consume the customer specific firebase for their private data storage.
Is there any experts can give me a hints how can I achieve this?
Thank you!
To programmatically create a project you can use this GCP create API and then link it to Firebase with this API. But they'd need an existing account already.
Alternatively you can have them create the account and project on their own through the console, and then use the list API to get a list of projects, have them pick one, and get the project config.
All of these are pretty raw APIs though, so you'll have to play around a bit to get the calls exactly right. Many of the REST APIs will have an API explorer link, which is typically helpful in figuring it out.

Custom authentication with Firebase Auth

I am currently working on a big software project that makes use of Firebase services. Especially Firebase Cloud Firestore, Firebase Storage, and Firebase Auth is used.
Multiple teams in one project
Teams can create their instance of the app to use the features of the app. From a technical standpoint, it is important to know that everything happens through one single Firebase project. Teams are not separated into multiple projects. From a feature standpoint, this is mandatory.
The authentication process
Admins of a team can manage the experience for the users of their team. They should also be able to modify the login methods and e.g. set up individual data to their Microsoft Azure AD account or Google Enterprise account. After a successful setup users of the team should be able to sign in with the prepared auth method by their team admin.
Possible approach
All available auth methods are enabled, set up, and ready to use (E-Mail, Google, Twitter, Microsoft, etc.). When a user opens the app and wants to sign in, the app checks which auth methods are enabled by the team admin and presents the appropriate UI.
Problem: Microsoft AD
Unfortunately, the metadata and values needed for Microsoft AD are set by the team admins and are different for every team. How can this be solved?

How to check which number of users(email/password auth) are currently logged in my apps from firebase console manually?

I need to see not total number of user. i only want them who are currently active (not signed out user) to my app through email and password. I want to see it from firebase console. help me please.
The Firebase Console doesn't show the number of users that are currently signed in to Firebase Authentication.
If you want to know how many users are actively using your app, you'll have to build something yourself.
Gaurav's comment about using an Analytics tool is a good hint. Even though Firebase's analytics SDK isn't available for the web, there are other analytics tools out there that would allow you to track the number of active users.
Another way is to write some information to a cloud database each time a user takes an action in your app. Then you can query that database to determine how many unique users recently took actions. That is actually pretty much what most analytics packages to. :)
A final option would be to use the Firebase Realtime Database's presence system, which uses a more active approach to detect how many users are currently connected to the database.

Firebase multi-tenancy with multiple users

I'm looking at Firebase as a backend for an MVP multi-tenant app. The app will be fully white labelled for each tenant, with each tenant signing up it's own user base. There will definitely be crossovers where users can register for more than one tenant however and I can't seem to see if this is supported by Firebase? essentially I would need to allow a user to register using the same email address to any number of tenants, without necessarily being aware that the tenants are the same system.
Is there anything that supports this?
Multi-tenancy is now supported by Google Cloud Identity Platform. Based on your question, this seems to be what you are looking for. See docs: https://cloud.google.com/identity-platform/docs/multi-tenancy-quickstart
You can create a dedicated Firebase project for each of your tenant. User accounts in one Firebase Authentication project are completely segregated from other projects.

Resources