Friends I’m trying to protect realtimeDB with authentication but I’m having difficulties. First of all as soon as the app starts a firebase permission error message is displayed and I can’t read or write anything to the DB.
I’m using Google account authentication and it’s working fine, I got the user ID, email and so on.
But it seems to me that firebase is not authenticating because when I release DB rules I can read and write normally and error messages will stop.
Does anyone know how to do this properly?
Can you send your rules JSON here?
Maybe one rule is overriding another, thus preventing read/write access.
Thanks
{
“rules”: {
“.read”: “auth != null”,
“.write”: “auth != null”
}
}
I have tried this too:
{
“rules”: {
“posts”: {
“$uid”: {
“.read”: “$uid === auth.uid”,
“.write”: “$uid === auth.uid”
}
}
}
}
Try changing auth != null
to auth.uid != null
What’s your database structure like? (what are the parent and child tags?)
I am just showing you the various ways I tried before resorting to the community. Being able to authenticate I probably solve the rest.
I don’t think it’s any of the rules, Unity is working normally.
It may be something I should do in the blocks and I’m not doing it for lack of experience.
Tell me, because I get the message: “FirebaseError Permission denied”
As soon as APP starts?
Are you fetching/storing Firebase data in Screen.Initialize?
It didn’t work either
Yes I am using firebase on the first screen, but I don’t do anything before signing in with the Google account.
Can you show us the relevant blocks in FirebaseAuthentication.LoginSuccess event?
Thanks
You gave me an idea that I had not tried yet, I will create another screen and only use the components of realtime database after going through the login screen. I think it’s a trick but I like to learn how things work.
Do you use realtimeDB with authentication? Does it work normally?
Yes. Works for me.
You can also try calling the Get Current User
block after Google authentication has succeeded. Then use the Got Current User
event (I’m not sure of the exact name ) and perform your Firebase actions.
This I had already tried, and it didn’t work either. I will follow the tutorial you sent me and review step by step, had not seen this tutorial yet.
I got the same results by following this tutorial. I recreated everything, even though it was the same thing I had done.
Even when I put the authentication rules in the DB I get the same “FirebaseError Permission denied” error when APP starts, even before attempting any DB operation.
I think it is not possible to use authentication in RealtimeDB.
Any solution? I’m running into the same problem.
I have the same problem.
I’m auth with authenfication Firebase but when i try to get a value in DataBase, the DataBase return acces denied.
Maybe need to join provider when trying to get value but how ?
Rules : write/read are auth != Null
Try the solution in this thread, it’s been working for me.