简体   繁体   中英

prevent firebase user from deleting himself

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?

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?

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)."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM