Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
74
rated 0 times [  78] [ 4]  / answers: 1 / hits: 5764  / 3 Years ago, sat, january 30, 2021, 12:00:00

Trust you are doing well. I am new to firebase and trying to do user authentication. I have installed pyrebase4 and created a project on the firebase console. I also enabled sign in with "Email and Password" and trying to connect with my app. Below is my code that I am trying:


    import pyrebase

#connect to firebase via key-value pair
firebaseConfig = {
"apiKey": "xxxxxxxxxxxxxxxxxx",
"authDomain": "xxxxxxxxxxx",
"projectId": "xxxxxxxxxxx",
"storageBucket": "xxxxxxxxxxxxxx",
"messagingSenderId": "xxxxxxxxxxxxx",
"appId": "xxxxxxxxxxxxxxxxxxxx",
"measurementId": "G-5GCDEC526E"
}

#initialize the app
firebase = pyrebase.initialize_app(firebaseConfig)

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

#user login authentication
email = input("Enter your email: n")
password = input("Enter your password: n")
user = auth.create_user_with_email_and_password(email, password)
auth.get_account_info(user['idToken'])

I am using VS Code as an IDE, Python 3.8, and Ubuntu OS. Below is the error I am getting:


python3 main.py
Traceback (most recent call last):
File "main.py", line 15, in <module>
firebase = pyrebase.initialize_app(firebaseConfig)
File "/home/sonu/.local/lib/python3.8/site-packages/pyrebase/pyrebase.py", line 28, in initialize_app
return Firebase(config)
File "/home/sonu/.local/lib/python3.8/site-packages/pyrebase/pyrebase.py", line 36, in __init__
self.database_url = config["databaseURL"]
KeyError: 'databaseURL'

Can you help me solve the issue? Thanks in advance.


More From » python

 Answers
13

As the error said. The databaseURL property is missing from your configuration.


Since now the Realtime Database is not automatically be created at the time you create the new firebase project so the databaseURL is not included by default. See also


[#1867] Monday, January 25, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
claudia

Total Points: 734
Total Questions: 106
Total Answers: 113

Location: Sweden
Member since Fri, Apr 16, 2021
3 Years ago
;