Angular fire auth:使用其uid删除

时间:2018-12-05 10:09:49

标签: firebase authentication ionic-framework firebase-authentication angularfire

我想从数据库中删除用户,所以我也需要注销并从auth中删除他。我使用Angular fire auth,但是我也不知道怎么做:

this.afAuth.auth.currentUser.delete().then(() => {
          this.afAuth.auth.signOut()
        })

带有指定的uid

1 个答案:

答案 0 :(得分:0)

您可以通过Firebase Admin SDK删除用户:

admin.auth().deleteUser(uid)
  .then(function() {
    console.log("Successfully deleted user");
  })
  .catch(function(error) {
    console.log("Error deleting user:", error);
  });

下次用户尝试获取ID令牌或重新加载ID时,他/她将退出。

相关问题