Manage Firebase user accounts - firebase

I have an administrative panel that lists all users on my system. I would like to be able to delete the account of a saved user in firebase.auth().
I know the firebase provides an SDK for this, but I do not have a server on Node, my site is hosted directly on Firebase hosting.
Is there any other way to do this?

Create a Cloud Function (serverless) that deletes users using the Node.js Admin SDK. Then you can hit that endpoint whenever you want to delete a user: https://firebase.google.com/docs/hosting/functions

You do have a node server. It's free. You can install node on your laptop or even better you can stand one up online. I use the free tier of cloud9 IDE (I do not work for them and I'm not trying to sell anything).
Easiest of all, use Firebase's web console to delete a user, unless you have a need to build out a more elaborate system.

Related

How to keep Firebase realtime database schema compatible in desktop application?

I am building a desktop application and added support for the Firebase realtime database. Because I am running a desktop application users will run different versions of my app.
As my app evolves, new features will be added and may require an update to the database schema as well. But I can't do this as I need to keep all client versions compatible.
For example, I have projects saved in the database at project/${uid}/${projectName}. Imagine in the future projects are not anymore tied to a user because I implement "collaboration" and want to change this path. How would I do this to keep all my clients up running?
You could store that path in realtime database and fetching the URL on client as required. I'm not sure what you mean by implement "collaboration" but if you want all the users to be on same version of your application then you would have to store the latest version in DB and verify the version yourself on client.
projects are not anymore tied to a user
In my opinion, if you could store a list of user UIDs who are a part of that project then that would be easier instead of structuring your app as projects/${uid}/projectname. If it is something like /projects/${projectId} then storing that list of authorized users would be much more easier.
There's Remote Config.
Firebase Remote Config is a cloud service that lets you change the behavior and appearance of your app without requiring users to download an app update.
You may have to use the REST API if your are building apps for desktop. Also as #Doug mentioned in comments, it may not synchronize all clients at same time.

How to create a firebase project with same structure as an existing one?

I'm working on a product which uses Firebase as its backend. Since firebase exposes the API keys to the user so that could be a security issue. So, after doing some research I've set the database security rules along with API keys restrictions.
But, now I'm unable to use it in local development as well. I was thinking of creating another firebase project and use that as a testing environment and use the existing one as production.
Since the existing project has a lot of data and users. I want everything similar in the new firebase project as well. But I'm unable to find an efficient way to do so. Can anyone please suggest what would be the best option here? Should I create a new testing environment or is there a way to allow me to use the keys locally without it causing a security concern?
Any help would be great. Thank you for your time.
There is no specific command to replicate one project to another, but you can build the necessary functionality yourself with each product's APIs.
For porting users between projects you can use:
The Firebase CLI, which has auth:import and auth:export commands.
The Firebase Admin SDK, which has commands to list all users and import a list of users.
For transferring data between the projects, you can use the API of the relevant database to read/write the data.

Migrating to FCM issue adding to console

After having issues with crashes in Android O and also seeing that GCM is fully deprecated we are trying to migrate to FCM. Keep in mind I did zero of the setup on this project, so I'm just trying to follow the migration guide. Our server side team is very busy right now, so I'm trying to make it as easy as I can for them.
So someone gave me owner permissions on the Google APIs dashboard for the project, where I can see that Google Cloud Messaging is enabled. So I gave owner permissions to an account we now use for all of our mobile online accounts and consoles.
Then I logged into the Firebase console, but when I click "add project" I do not have the option to import the existing GCM project, as the docs seem to say I should. It also doesn't show up for my personal work account either, even though it is also an "owner" account. I was really hoping to migrate this way so that we might not have to get new api keys.
However, I do see in the Google APIs dashboard that I can "enable" FCM from there. Will this create the Firebase project for me and if so will it generate new keys or can we use the old ones?
OR is it actually better to just create an entirely new FCM project?

Firebase: multiple Apps connected to single firestore

This is intentionally a very broad question. Sorry about that.
I'm experimenting with firebase for the first time. I would like to build a little e-commerce webapp using firebase, React and Next. I would like to split the App in two different apps: one admin app (used to create products and do other admin stuff) and the actual shop app. The Apps should be hosted on two different domains but they should talk to the same cloud firestore.
What would be a good setup to implement this architecture? Currently I am thinking about creating separate firebase projects for the admin and the shop app so I can host them on different domains. The cloud firestore would live in the admin project together with all admin related cloud functions etc. The shop app (or client app) would have its own project for hosting and would be connected to the firestore from the admin project.
Does that sound like a reasonable architecture or am I completely on the wrong path. Any suggestions are appreciated. And again sorry for the broadness of the question.
You don't need to do anything special. Each app (mobile, web,whatever) connects to a firebase instance/project. You can just set them all up to use the same firebase project (.plist file etc) and it will all work. The advantage of this design is that both admin and client access the same data, which presumably you need. (If you haven't found it, on the Firebase Console -> Settings -> Project Settings; add applications which will generate the appropriate credential files for each device type.)
Since you will have a shared/common authentication space, you may find that you want to add a flag/limitation to login so that only specified users can access the admin side. There's a few ways this can be accomplished.

MeteorJS app architecture guideline required

I am building a marketplace Meteor app but I am confused about the app architecture. I want to build front end user interface for marketplace, Customer dashboard, Vendor dashboard, admin user interface and meteor mobile apps for customers and vendors. I know Meteor bundle everything in client folder and send it to the client. My question is do I need to use same hosted Mongodb database and create separate Meteor apps for
App 1 Marketplace user interface and Customer dashboard.
APP 2 Vendor dashboard.
APP 3 Admin user interface
App 4 Meteor Mobile App for Customers
APP 5 Meteor Mobile App for Vendors
OR
Create a single Meteor App for everyone. but in that case app size will increase.
OR
Create separate Meteor apps and connect all other apps to APP 1 (Marketplace App) through DDP to share publications and methods.
Please help me decide best architecture.
Option 1:
I've done so using a single MongoDb instance. I currently have four apps connected to it. It works really well.
Make sure you use the oplog for instant updates across all the apps.
Some of the security benefits of this approach were unexpectedly nice. For example, allow and deny rules being created with only one type of user in mind for each app. If someone has access to admin.yoursite.com for example, the permissions allow all sort of things for admins, but for the client facing app, the permissions can be locked down to only allow editing of the few things that are required.
You can get pretty far with this approach, I recommend it.
Option 2:
I wouldn't recommend making a large app that does everything.
Option 3:
Not to say there is no benefit to that sort of approach, but "APP1" in this case should probably be some sort of event log, which each app can subscribe to the events of and write events to, and update their own databases. This is the most complex (and expensive) solution, and I wouldn't recommend it until you are trying to scale really large. If you are interested in this type of approach I recommend looking into Event Sourcing/CQRS.

Resources