在Firebase 3之前,有一个功能" removeUser"删除包含电子邮件和密码(https://www.firebase.com/docs/web/api/firebase/removeuser.html)
的现有帐户但我似乎无法在Firebase 3中找到类似的功能。这样做不再可能吗?
答案 0 :(得分:2)
您正在寻找user.delete()
功能。这是documentation。
var user = firebase.auth().currentUser;
user.delete().then(function() {
// User deleted.
}, function(error) {
// An error happened.
});
请注意,这是一项关键操作,因此需要事先调用reauthenticate
:
var user = firebase.auth().currentUser;
var credential = firebase.auth.EmailAuthProvider.credential(user.email, userProvidedPassword);
// Prompt the user to re-provide their sign-in credentials
user.reauthenticate(credential).then(function() {
// User re-authenticated.
}, function(error) {
// An error happened.
});