thisbejim / Pyrebase

A simple python wrapper for the Firebase API.
2.06k stars 528 forks source link

can't access data when rules are "auth!=null" (firebase). Says "error" : "Permission denied" #291

Open thegoliathgeek opened 5 years ago

hbg commented 5 years ago

Try with these rules: { "rules": { ".read": true, ".write": true } } If that doesn't work, just use those rules but also login in with authentication as well as an authentication token. I believe I ran into a similar problem a while ago.

thegoliathgeek commented 5 years ago

@harrisbegca Thanks i'll check it out

hasnainroopawalla commented 5 years ago

Try with these rules: { "rules": { ".read": true, ".write": true } } If that doesn't work, just use those rules but also login in with authentication as well as an authentication token. I believe I ran into a similar problem a while ago.

How to do that? I have currently set my rules to:

{ "rules": { ".write" : "auth!=null", ".read" : "auth!=null" } }

I want to login the user but it says failed. These same rules work on my android app but not on my web app. How do I log the user in with an authentication token as well (Using pyrebase)? Thanks.

APDos commented 5 years ago

If you're using .get(), you need to use authorization to login with an email and password, then use the idToken for that user in .get(). So:

auth = firebase.auth() user = auth.sign_in_with_email_and_password('admin@admin.com', 'password')

db = firebase.database() stuff = db.child('childvalue').get(user['idToken'])

LuisBuelvas commented 4 years ago

Hello I am using this line of code

`auth = firebase.auth() user = auth.sign_in_with_email_and_password('admin@admin.com', 'password')

db = firebase.database() stuff = db.child('childvalue').get(user['idToken'])`

but I still have the same problem .. can you help me

thegoliathgeek commented 4 years ago

@LuisBuelvas I think database secret should be used to avoid this !

NerdPraise commented 4 years ago

Same issue here, I am trying to log in a user, but I get the permission denied error. I can't get the user id token if the user is not logged in yet