Fiebase error

54 views
Skip to first unread message

UPSC prep

unread,
Jun 2, 2021, 5:22:14 AM6/2/21
to Firebase Google Group
Guys please anyone help me to out I am writing a fire base rule & i want it should be secure i have used firebase authentication and specified a folder for each user where his data is stored i just want that only that perticular user can access his folder my rule is 
{
 "rules": {
     "users": {
      "$uid": {
        ".read": "auth.uid == $uid",
          ".write": "auth.uid == $uid"
      }
    }
  }
}

in this rule i am  getting two problem 
1.new user data cant be wriiten in users node
2. since read is false so in my app its showing an error which is permission denied

Rachel Myers

unread,
Jun 2, 2021, 3:31:37 PM6/2/21
to fireba...@googlegroups.com
The structure looks right to me. 

It's important to use `===` instead of `==` to compare the UIDs.

I would also check that there's a real auth object and uid by printing that out in the app. If the uid is null, then this will fail.

Hope that helps!
Rachel



--
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/86b83b3c-b117-4159-88f4-92b4ff63815dn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages