How to disable a user from firebase?

Asked
Active3 hr before
Viewed126 times

5 Answers

disablefirebase
90%

Firebase admin (node.js)- which is not available for Mobile platform - has the ability to do the disabling/deleting the user by using the Admin SDK. To disable a user, set the disable attribute to TRUE. ,Using the Realtime Database Rules,The other option is to restrict the user access (read/write) to database by setting Users table in realtime database. You can add a flag field (active) in that table for example:

The other option is to restrict the user access (read/write) to database by setting Users table in realtime database. You can add a flag field (active) in that table for example:

{
   "users": {
      "3sFGw6zlr8VylNuvmCWd9xG1CQ43": {
         "active": true,
         "address": "#123, City",
         "createdBy": "2016-12-20",
         "mobile": "xxxxxxx"
      },
      "posts": {}
   }
load more v
88%

The solution is simple. Prepare a collection (e.g. bannedUser) for the suspended account in the database, and create a document of the ID of the target user there. Next, add a condition on whether the requestor is included in the collection in the database rule. It becomes as follows. The database rule as follows.,The above rule can prevent comments from being written from the target user. The point is to use the exists method of rules.firestore.,This article is a method to invalidate the account of a user who is using anonymous sign-in using Firebase Authentication. I was somewhat troubled when trying to suspend an account of a violating user so write it down.

Pretag
 Pretag team - issue, fix, solve, resolve
72%

In addition to the properties of a create request, the following properties can be provided:,If you provide none of the properties, an anonymous user will be created.,Before you can authenticate users with email link sign-in, you will need to enable email link sign-in for your Firebase project.

{
   "uid": "jEazVdPDhqec0tnEOG7vM5wbDyU2",
   "email": "user@domain.tld",
   "emailVerified": true,
   "displayName": null,
   "photoUrl": null,
   "phoneNumber": null,
   "disabled": false,
   "metadata": {
      "createdAt": "2018-02-14T15:41:32+00:00",
      "lastLoginAt": "2018-02-14T15:41:32+00:00",
      "passwordUpdatedAt": "2018-02-14T15:42:19+00:00",
      "lastRefreshAt": "2018-02-14T15:42:19+00:00"
   },
   "providerData": [{
      "uid": "user@domain.tld",
      "displayName": null,
      "screenName": null,
      "email": "user@domain.tld",
      "photoUrl": null,
      "providerId": "password",
      "phoneNumber": null
   }],
   "passwordHash": "UkVEQUNURUQ=",
   "customClaims": null,
   "tokensValidAfterTime": "2018-02-14T15:41:32+00:00"
}
load more v
65%

Now when you delete/disable a user's account in your Firebase console, you also need to add the corresponding uid to the list of banned users in the database.,FirebaseAuthInvalidUserException thrown if the current user's account has been disabled, deleted, or its credentials are no longer valid,If you want to revoke the user's authorization immediately, you'll have to do so in another part of your application logic. A common practice when it comes to Firebase is to create a new node in your database called blacklist that should look like this:

If you want to revoke the user's authorization immediately, you'll have to do so in another part of your application logic. A common practice when it comes to Firebase is to create a new node in your database called blacklist that should look like this:

Firebase - root |
   -- - bannedUsers |
   uidOfBannedUser: true
load more v
75%

Is there an admin tool to help me query and disable users in bulk?,Just like the firebase admin tools that I've seen, where I can just key in my private key and project url and then do some queries on "date created" , username searches etc.,To clarify, what I'm currently doing manually is I goto the firebase console -> Authentication -> find user and check if their identifier is bot like string and joined on a particular date and then disable it.

Pretag
 Pretag team - issue, fix, solve, resolve

Other "disable-firebase" queries related to "How to disable a user from firebase?"