Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Realtime database rules "Unknown variable 'request'."

enter image description here

Does anyone know why I can't use this snippet from here https://firebase.google.com/docs/rules/basics#realtime-database_2

like image 345
sanevys Avatar asked Sep 04 '20 13:09

sanevys


1 Answers

It looks like a documentation mistake because in Firestore you would write request.auth.uid while in the RTDB you just write auth.uid.

{
  "rules": {
    "some_path": {
      "$uid": {
        // Allow only authenticated content owners access to their data
        ".read": "auth != null && auth.uid == $uid",
        ".write": "auth != null && auth.uid == $uid"
      }
    }
  }
}
like image 61
Brian Burton Avatar answered Nov 08 '22 07:11

Brian Burton