Reputation: 289
If I open a website with firebase installed and i execute this firebase.auth().currentUser.delete() in browser console after a user has logged in, the current user will be deleted. How can i prevent a user from calling the delete function. is there a way to disable this?
Upvotes: 5
Views: 1359
Reputation: 600141
If you upgrade your project to Google Cloud Identity Platform (a drop-in upgrade) you can now disable:
Both of these (and the ability to toggle protection against email enumeration attacks) can be set in the user actions panel of the Firebase console.
Previous answer 👇
There is no way to prevent a user from deleting their Firebase Authentication account. But whether you expose such functionality in your app is of course up to you.
It sounds a bit like an XY problem. What app-level problem are you trying to accomplish by disabling users from deleting their Firebase Authentication account?
Upvotes: 2
Reputation: 50930
You can now prevent users from deleting their own accounts by unchecking "Enable delete" in the Firebase console. This was available only in Cloud Identity Toolkit console before.
Using deleteUser()
will throw an error "Firebase: Error (auth/admin-restricted-operation)."
Upvotes: 4