繁体   English   中英

如何连接 Firebase Auth 模拟器和 Python

[英]How to Connect Firebase Auth Emulator With Python

我是 python 的新手,正在尝试弄清楚如何将我的 auth 模拟器与 python 项目连接起来。 实际上,我想在模拟器上创建用户,但是当我创建一个用户时,它是在我的实时 firebase 项目上创建的

  • 我在我的 python 项目中有 firebase 项目
  • 我已经从终端导出了以下环境变量export FIREBASE_AUTH_EMULATOR_HOST="localhost:9099"并且还从我的文件中设置了os.env但对我没有任何作用
  • 我还使用了 pyrebase create_user_with_email_and_password提供的方法来创建用户,但这会在 firebase 真实项目上创建用户我到目前为止所做的图像在这里

如果有人知道解决方案,请告诉我,我将非常感激!

如果这对其他人有帮助,这就是我在 python 中设法连接和使用身份验证模拟器的方式:

# Import auth from firebase admin
from firebase_admin import auth

# Set the auth emulator environment variable to the correct port, as shown when starting up the emulator.

if USE_EMULATOR == 'True':
  os.environ["FIREBASE_AUTH_EMULATOR_HOST"] = "127.0.0.1:9099"


user = auth.create_user(email=email, password=password )

暂无
暂无

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

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