How to use auth in python Firebase to set database rules?

303 views
Skip to first unread message

Victor Santos Silva

unread,
Dec 22, 2020, 6:07:28 PM12/22/20
to Firebase Google Group
Hello everybody, is everything ok?

I am working in a flask project which uses some firebase services. I can push a value in the 
database, upload files and register new accounts without any problem. But I am facing some difficult to connect the push or the upload to the user whose did it. 
I would like to set this rules for read and write actions ("auth != null"), in my database. It 
works as expected, but the I only can post if I set, in firebase_admin.initialize_app:

...
'databaseAuthVariableOverride': {
        'uid': 'my-service-worker-or-any',
    }
...
It makes my application a bit more secure. But it remains a problem because I can't get any user
information. I would like to allow for each user the access of your own path. I have a jupyter notebook 
in this notebook I can post, because it is guaranteed by firebase_admin, I would like to get information 
about the user, therefore the post should be guaranteed by login. Anyone has one idea where I am missing? 
Every source, repository or documentation will make me very grateful. Thank you so much, have a nice day!

Sam Stern

unread,
Dec 23, 2020, 6:26:14 AM12/23/20
to Firebase Google Group
Hi Victor,

As far as I can tell Pyrebase is meant for admin actions only, so Database writes from Pyrebase don't go through security rules.  We don't have any official Python client SDK so I would suggest asking the author of Pyrebase if you're having trouble with that library.

- Sam

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/fc2a1ef5-0db5-41b5-b9a0-0ca666638f26n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages