1
import pyrebase

config = {'apiKey': "AIzaSyCIkjXwfFCXuWavGkiy39MEx8aG9QsRpxE",
    'authDomain': "sparkwebdevsujit.firebaseapp.com",
    'projectId': "sparkwebdevsujit",
    'storageBucket': "sparkwebdevsujit.appspot.com",
    'messagingSenderId': "2928150243",
    'appId': "1:2928150243:web:cdee0458e5da8b3e8e27d6"}

firebase = pyrebase.initialize_app(config)

# db = firebase.database()
auth = firebase.auth()
# storage = firebase.storage()

email = input("email : ")
password = input("password : ")
auth.sign_in_with_email_and_password(email,password)

i am trying simple signin though firebase and it is giving error which is

File "c:\Users\sujit\Desktop\firebase\main.py", line 10, in <module>
    firebase = pyrebase.initialize_app(config)
  File "C:\Users\sujit\AppData\Local\Programs\Python\Python310\lib\site-packages\pyrebase\pyrebase.py", line 28, in initialize_app
    return Firebase(config)
  File "C:\Users\sujit\AppData\Local\Programs\Python\Python310\lib\site-packages\pyrebase\pyrebase.py", line 36, in __init__
    self.database_url = config["databaseURL"]
KeyError: 'databaseURL

i dont know what i did wrong i followed letter bt letter

  • 1
    The error text says pretty much all: your *config* dictionary doesn't have a key named *databaseURL* (which is true). In other words it doesn't know where to connect to. – CristiFati Mar 07 '23 at 09:04

1 Answers1

0

first go to your Firebase console and click on your project and select Real-time database if it is not created click on create you can find your database URL there on code below replace your database URL.


    config = {
        'apiKey': "AIzaSyCIkjXwfFCXuWavGkiy39MEx8aG9QsRpxE",
        'authDomain': "sparkwebdevsujit.firebaseapp.com",
        'projectId': "sparkwebdevsujit",
        'databaseURL':"your database url",
        'storageBucket': "sparkwebdevsujit.appspot.com",
        'messagingSenderId': "2928150243",
        'appId': "1:2928150243:web:cdee0458e5da8b3e8e27d6"
    }