我正在使用 Ionic2/Angular2,并且一直在寻找有关如何从 Firebase 删除用户的示例。
如果有人有任何例子,请帮忙吗?
谢谢
最佳答案
我有两个选择给你:
下拉至 native Firebase SDK
如图所示,您可以按照 this SO answer 中的步骤操作获取当前用户,并将其删除。
这将允许你做一些类似的事情,from the docs :
var user = firebase.auth().currentUser;
user.delete().then(function() {
// User deleted.
}, function(error) {
// An error happened.
});
试试这个片段
使用 AngularFire2,how about this approach ?
af.auth
.first()
.subscribe(authState => {
console.log(authState);
authState.auth.delete()
.then(_ => console.log('deleted!'))
.catch(e => console.error(e))
});
不要忘记.first()
关于angular - 使用 Angular2/Ionic2 删除 Firebase 用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41902415/