简体   繁体   中英

How to Connect Firebase Auth Emulator With Python

i am new to python and trying to figure out how to connect my auth emulator with python project. Actually, i want to create the users on emulator but when i create a user it is created on my real time firebase project

  • I have ini the firebase project in my python project
  • I have exported the following environment variable export FIREBASE_AUTH_EMULATOR_HOST="localhost:9099" from terminal and also set the os.env from my file but nothing worked for me
  • I also used the method provided by pyrebase create_user_with_email_and_password for creating a user but this creates the user on firebase real project The image of what i have done so far is here

If anyone knows the solution please let me know it will be very grateful for me!

In case this helps someone else, this is how I managed to connect and use the auth emulator in 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 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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