python桌面应用程序的Firebase身份验证过程
我需要在项目中的数据库实现方面提供一些帮助。
最终实施: 网站: 我想创建一个(烧瓶)网站,用户可以在其中创建或删除帐户。 桌面应用程序: 我还想制作(PYQT)Python应用程序,用户可以通过登录提示登录其帐户。 数据库: 我想制作一个(firebase)数据库,以便用户可以进行身份验证。数据库还将收集一些用户信息,除了身份验证凭据。
到目前为止的实施: firebase: 我在Firebase中创建了一个“ Web应用程序”,因此我通过Firebaseconfig Flask网站与Firebase进行通信
: 我创建了一个通过Firebaseconfig与Firebase进行通信的烧瓶网站。用户填写表单,而firebase身份验证通过(create_user_with_email_and_password)创建用户。数据库还收集了一些额外的用户信息。 (我认为我的代码是“安全的”,因为它是服务器端)
问题:
Python应用程序: 我创建了一个Python应用程序,用户可以登录到Firebase身份验证。我面临的问题是,我“必须”将Firebaseconfig包括在我的Python代码中。使用FirebaseConfig,我可以创建并删除用户,但是我不希望其他用户能够执行此操作。 (因此,我认为我的代码不安全,因为与Firebase的通信是客户端,因此有人可以对代码进行反复编译并获得FirebaseConfig)。
使我的项目更安全的最佳方法是什么?
I want some help with the database implementation in my project.
The final implementation:
Website:
I want to make a (flask) website where the user can create or delete an account.
Desktop application:
I also want to make a (PyQt) python application that the user can log in to his/her account via a login prompt.
Database:
I want to make a (firebase) database so the users can authenticate. The database will also collect some user information except the authentication credentials.
The implementation until now:
Firebase:
I created a “web app” in firebase so I communicate with firebase via firebaseConfig
Flask website:
I created a flask website that communicates with the firebase via the firebaseConfig. The user fills in a form, and the firebase authentication creates a user via (create_user_with_email_and_password). The database, also, collects some extra user information.
(I think that my code is “safe” as it is server-side)
The problem:
Python application:
I created a python application that the user can log in to the firebase authentication. The problem I faced is that I “have to” include the firebaseConfig in my python code. With the firebaseConfig I can create and delete users, but I don’t want the other users to have the ability to do this.
(so I think my code is unsafe because the communication with the firebase is client-side so someone may decompile the code and get the firebaseConfig).
What is the best way to make my project safer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您正在使用适用于 Python 的 Firebase Admin SDK,它(与所有 Admin SDK 一样)以提升的权限运行,并且只能在受信任的环境中使用(例如您的开发计算机、您控制,或 Cloud Functions/Cloud Run)。
Firebase 没有提供可在您发送给应用的常规用户的 Python 应用程序中使用的 SDK。这意味着您的选项仅限于使用 REST API 登录与 Firebase 一起使用,或使用第三方库,例如 Pyrebase(请确保不要在那里使用服务帐户,因为这会使其以与 Admin SDK 相同的提升权限运行)。
It sounds like you're using the Firebase Admin SDK for Python, which (like all Admin SDKs) runs with elevated privileges and should only be used in trusted environments (such as your development machine, a server that you control, or Cloud Functions/Cloud Run).
There is no Firebase-provided SDK for use in Python applications that you ship to regular users of your app. That means that your options are limited to either using the REST API to sign in with Firebase, or to use a 3rd party library, such as Pyrebase (be sure to not use a service account there, as that'd make it run with the same elevated privileges as the Admin SDK).