Disable User Account in Firebase Web JS

Viewed 257

I am using Firebase Authentication to authenticate Users using Email/Password Method .. Sometimes I detect Spam User that Create A lot of accounts from ip Address So I want to block them to protect project So I know there is method called Disable User Account in Firebase Console .. So I want to use it in in my project So far I searched in Stack Overflow & Docs & Reference and found That is only can be done in Admin SDK But I want to use in Firebase Web JS not Admin So is there method to do that using method user.DisableAccount or method like that.

1 Answers

There is no method to disable a specific user's account in the client-side Firebase SDKs, as that would be a security risk.

But if you look at documentation for updating a user with the Admin SDK, you'll see there is a property disabled that you can set to true.

From that moment in, that user won't be able to sign in or refresh their ID token. Their existing ID token is still valid though, and by default that means it may take up to an hour for them to get signed out of your app. If that interval is a concern for your use-case, have a look at the documentation on managing user sessions, specifically the section on detecting ID token revocation. While more work, this allows you more granular control of the expiration of the token.

Related