【问题标题】:How to authenticate to Firebase using Python?如何使用 Python 向 Firebase 进行身份验证?
【发布时间】:2020-02-28 18:34:19
【问题描述】:

我正在使用 Python 构建一个 Web 应用程序,并且我想对用户进行身份验证。 pyrebase 包似乎已经过时,它会产生依赖错误,所以我不能使用它。 我知道firebase-admin API 中有一个函数是这样工作的:

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

但是如果这个用户有密码怎么办?我想检查是否正确提供了电子邮件和密码。提前致谢。

【问题讨论】:

    标签: python firebase firebase-authentication firebase-admin


    【解决方案1】:

    Firebase Admin SDK 没有当前用户的概念,因此没有 API 可以根据用户的凭据“登录”用户。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-10
      • 2019-08-14
      • 2021-03-01
      • 1970-01-01
      • 2019-08-09
      • 2020-10-09
      • 2017-03-11
      • 1970-01-01
      相关资源
      最近更新 更多