简体   繁体   English

如何使用 python 登录 Firebase Auth

[英]How to sign in with Firebase Auth using python

I'm trying to make an app and I can't figure out how to sign in to a user with the python library firebase_admin.我正在尝试制作一个应用程序,但我不知道如何使用 python 库 firebase_admin 登录用户。 I don't have any code as of this moment.截至目前,我没有任何代码。 Let me know if you can help me out.如果你能帮助我,请告诉我。

The Firebase Admin SDK is designed to be used in a trusted environment, such as your development machine, a server you control, or Cloud Functions/Cloud Run. Firebase Admin SDK 旨在用于受信任的环境,例如您的开发机器、您控制的服务器或 Cloud Functions/Cloud Run。 It gets its authorization from its context or from a credentials file that you provide to it, and which gives it full, administrative access to the project.它从其上下文或您提供给它的凭据文件获得授权,并赋予它对项目的完全管理访问权限。 Therefor it doesn't need, and doesn't have a way, to sign in as a specific user.因此,它不需要也没有办法以特定用户身份登录。

If your use-case requires that you sign a user in to Firebase from your Python code, you can consider calling the REST API to authenticate .如果您的用例要求您从 Python 代码将用户登录到 Firebase,您可以考虑调用REST API 进行身份验证 But the use-case for this would typically be to then pass the ID token you receive back to a user (similar to the use-case in creating custom tokens ).但是这个用例通常是将您收到的 ID 令牌传回给用户(类似于创建自定义令牌的用例)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM