如何自动禁用firebase身份验证上的用户帐户?

Dck*_*w24 5 android firebase firebase-authentication firebase-realtime-database

我目前正在开发一个使用Google Firebase作为后端服务器的Android应用程序.

我想实现的一个功能是禁用用户帐户,因为他们通过应用程序注册但我不知道如何操作.

有谁知道如何将这个实现到android代码本身?

Wil*_*lik 8

没有办法从Android客户端SDK禁用用户帐户.

您必须使用Firebase Admin SDK才能实现此目的.

admin.auth().updateUser(uid, {
    disabled: true
});
Run Code Online (Sandbox Code Playgroud)

指南链接:Firebase管理员 - 更新用户

编辑:谢谢@FrankvanPuffelen

在Firebase云功能上创建Firebase用户时,您还可以触发此功能.

在这里阅读更多

  • 如果您在创建用户时从云功能自动触发此功能,您将获得相当不错的流量.请参阅https://firebase.google.com/docs/functions/auth-events#trigger_a_function_on_user_creation (2认同)
  • 我用 firebase 函数尝试了这个,它需要很长时间才能触发,所以最近创建的用户在它被禁用时已经自动登录:-(,导致管理员用户注销 (2认同)