【问题标题】:I can't delete user authentication我无法删除用户身份验证
【发布时间】:2020-06-02 00:12:45
【问题描述】:

我目前正在开发用户 crud,但缺少最后一步,即删除用户的身份验证帐户,但我无法做到这一点。怎么了?

代码:

 deleteUserButton.addEventListener('click', function(){
     firebase
        .auth()
        .signInWithEmailAndPassword(email, password)
        .then(function(user){
            user.delete()
      })
})

【问题讨论】:

  • 您可能希望将catch 添加到您的promise/signInWithEmailAndPassword 以获取/记录潜在错误。很难,我做不到不是很准确的描述。

标签: node.js firebase firebase-authentication


【解决方案1】:

删除用户需要使用这个方法

var user = firebase.auth().currentUser;
user.delete().then(function() {
  // User is deleted.
}).catch(function(error) {
  // if error occur
});

【讨论】:

    猜你喜欢
    • 2020-04-18
    • 2021-02-28
    • 2015-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多