0
votes

I tried

https://recipes-fe1ba.firebaseio.com/products.json?auth' + token

And in firebase rules , I tried

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

NOT working event after I sent actual NOT null token. It throws 401 with below error object .

      { "error" : "Could not parse auth token." }

Can somebody highlight on this ?

I need help also on how to read my own query parameter in firebase data rules For example: if i hit

https://recipes-fe1ba.firebaseio.com/products.json?mypara1=1234

in data rules,something like

{".read": "mypara1 != 1235"}

Currently stuck and no clue how to do this.

2
Please limit yourself to one question per post. I answered your second question below.Frank van Puffelen

2 Answers

0
votes
"products" : {
   ".read": "auth != null",
    ".write": "auth != null"
 }

remove single cotes from auth

0
votes

For your second question: the only ways you can pass in data to security rules is through the path that you read, and through the auth token of the user. There is no way to pass custom parameters into security rules through the URL like you're trying.

The typical approach is to pass them into the path instead. So something like:

https://recipes-fe1ba.firebaseio.com/products/mypara1_1234.json