Try to search your question here, if you can't find : Ask Any Question Now ?

Permission denied on Firebase Database using Pyrebase [Python]

HomeCategory: stackoverflowPermission denied on Firebase Database using Pyrebase [Python]
rupesh asked 6 days ago

I have managed to sign up a user and properly sign them in shortly after they’ve signed up all in the same requests. Also in my request, I am trying to store the user information in the Firebase Database using the python package Pyrebase.

I have properly initialized my firebase app as well as my firebase database within my flask app

config = {
    "apiKey": "apikey",
    "authDomain": "proj.firebaseapp.com",
    "databaseURL": "https://proj.firebaseio.com",
    "storageBucket": "proj.appspot.com",
    "messagingSenderId": "930158028418",
    "serviceAccount.json": "path/to/theServiceAccountStuff.json"
}

app = Flask(__name__)
firebase = pyrebase.initialize_app(config)
auth = firebase.auth()
firedb = firebase.database()

I am creating this dictionary

userInfo = {"email": email, "password": password, "stripeID": customer.id, "subscriptionID": subID,"subscription": "active", "startdate": "Today bro"}

And passing it into my into my set function that is suppose to (or at least I thought it did) save my JSON object into the Firebase Database.

firedb.child("users").child(user['localId']).set(data=userInfo)

I am trying to store users under “users” and then categorize them all with a custom key being their localId.

For some reason everytime, I hit hit the line of code above, I get an error saying this

requests.exceptions.HTTPError: [Errno 401 Client Error: Unauthorized for url: https://myproj.firebaseio.com/users/someid.json] {
  "error" : "Permission denied"
}

These are my database rules in firebase

enter image description here

Is there something I am missing? I have even gone a step further to remove all rules so anyone can access it and I have also put in dummy data just to see if it works. Dummy data is possible because I am manually entering in all the information.

1 Answers
Best Answer
Matthias answered 6 days ago
Your Answer

11 + 3 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com