Get All Users From Auth in Cloud Functions for Firebase

firebase

To get all the users from auth in Firebase, you can use the Admin SDK for Firebase. It gives you elevated privileges to perform operations in the system that a normal user can not. The Admin SDK comes with a lot of functionality built-in. But, the one thing that we care about here is Managing Users. Getting Users […]

How to Import Large Amount of Data to Cloud Firestore

firebase

Firestore has been out of beta for some time now. But it still doesn’t support import or export functionality natively. This is a big downer for someone wanting to use the native functionality of the Firebase platform. Keep in mind that when I talk about enabling exports/imports, I’m talking about the firebase-admin SDK. Export/Import via the gsutil command-line utility is […]

Get All Dictionary Keys in Firestore Using Firebase Cloud Functions

firebase

In Firebase, you can get all the keys of an Object very easily. The thing that you should note is that a dictionary is just an Object in Firestore. All the custom Objects that you store in the Firestore behave just like the native Javascript objects. To get all keys of an object, you can simply use the Object.keys() method that is available for […]

Protect Firebase Cloud Functions From Unauthorized Access

firebase

In this tutorial, I’ll show you how you can protect your https cloud functions from unauthorized users in Firebase. By restricting unauthorized users, you can save resources and thus decrease the overall cost of your app. Setting Up The Project Using the command-line, initialize the Firebase project as follows: $ mkdir cf-auth $ cd cf-auth […]

How to Enable CORS in Node.js Without Express CORS Middleware

It’s very easy to simply install the cors middleware to handle all the CORS stuff while using Node.js as your backend. This, however, leaves you with a very superficial understanding of how the Cross-Origin Resource Sharing mechanism works. In this article, we will add CORS to a very simple http server in Node.js without using Express or […]

How to Get Server Timestamp Using Firebase Cloud Functions

firebase

In this tutorial, we are going to create a Cloud Function which will return the server timestamp. Getting the Firebase Server Timestamp If you only care about the timestamp and not what format it comes in the result, this method is for you. You can simply create an endpoint in your https API which will […]

How to Enforce Unique Field Values in Cloud Firestore

firebase

The Cloud Firestore is an awesome platform for quickly prototyping your app ideas into reality, however, it certainly comes with some limitations. Currently, there is no way for you to enable uniqueness in field values in the whole database. There is a quick workaround, though with queries that you can use. The Problem You want […]

Harden WordPress After Initial Setup for Security and Safety

Over the years, I have set up hundreds of WordPress installations. But every time I do that, I have to look around for guides and tips for making WordPress usable and secure. That takes up a lot of my time and repeating this step is always a pain in the butt. This article is for […]