首页 > 解决方案 > 在 Firebase 身份验证时间段后禁用用户帐户

问题描述

我想设置一个时间段来自动停用用户。示例:7 天后禁用用户 x 或注册用户的方法,默认禁用 true

我目前正在使用 pyrebase 和 pyqt5 以这种方式注册

def register(self, screen):
        email = screen.email.text()
        password = screen.password.text()
        confirmpass = screen.confirmpass.text()
        if password == confirmpass:
            try:
                self.auth.create_user_with_email_and_password(email, password)
                self.msg_error_registro(screen, msg="Registration successful", bgcolor="background-color:rgb(85, 255, 127);")
                screen.email.setText("")
                screen.password.setText("")
                screen.confirmpass.setText("")
            except requests.exceptions.HTTPError as httpErr:
                self.error_message = json.loads(httpErr.args[1])['error']['message']

标签: pythonfirebase-authenticationfirebase-adminpyrebase

解决方案


Firebase 身份验证中没有内置任何内容可以在一定时间后自动禁用帐户。我也没有在 Pyrebase 中看到设置用户帐户的禁用标志的调用,尽管通过 Pyrebase 包装的 REST API 当然可以这样做。

您是否考虑过使用 Firebase Admin SDK for Python,它支持禁用帐户和更多操作?


推荐阅读