How to authenticate to Firebase using Python?

喜夏-厌秋 提交于 2020-01-11 14:31:12

问题


I am building a Web App with Python and I would like to authenticate users. The pyrebase package seems to be outdated and it generates dependency errors so I cannot use it. I know that there is a function from the firebase-admin API that works like this:

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

But what if this user has a password? I would like to check if the both the email and the password are provided correctly. Thanks in advance.


回答1:


The Firebase Admin SDK does not have the concept of a current user, so there's no API to "sign in" a user based on their credentials.

Since you're building a web app, the usual flow is to use the Firebase JavaScript SDK in your client-side code to sign the user in. If needed you can then send the ID token from the client to your Python code on the server, and perform user-based operations there.



来源:https://stackoverflow.com/questions/58676559/how-to-authenticate-to-firebase-using-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!