如何使用Python对Firebase进行身份验证?

2024-03-29 10:30:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在用Python构建一个Web应用程序,我想对用户进行身份验证。 pyrebase包似乎过时了,它生成了依赖项错误,因此我无法使用它。 我知道firebase-adminAPI中有一个函数的工作方式如下:

from firebase import auth
email = example@example.com
user = auth.get_user_by_email(email)

但是如果这个用户有密码呢?我想检查一下电子邮件和密码是否都提供正确。提前谢谢。你知道吗


Tags: 函数用户auth身份验证web应用程序密码example
1条回答
网友
1楼 · 发布于 2024-03-29 10:30:51

Firebase管理SDK没有当前用户的概念,因此没有API根据用户的凭据“登录”用户。你知道吗

由于您正在构建一个web应用程序,通常的流程是在客户端代码中使用Firebase JavaScript SDK来sign the user in。如果需要,您可以send the ID token from the client to your Python code on the server,并在那里执行基于用户的操作。你知道吗

相关问题 更多 >