I am currently trying to implement rate limting by checking the timestamp of the last post and then add + 60sec to it and then check if it is smaller(<) then the current Firebase Server Timestamp(now).
It somehow always returns true and grants access ?!
These are my Rules:
{
"rules": {
"posts": {
".read": true,
".write":
"(root.child('users').child(auth.uid).child('lastPost').val() + 60) < now"
}
}
}
This is my database structure
{
"posts": {
"-KV70ppGGTEtXY4_Q4UC": {
"author": "abcdedef-uid-ojifgoöifjgssgd",
"description": "Thats the post description",
"title": "Thats the post title"
}
},
"users": {
"2uy7323nTodMHcVxeEDJzoexH302": {
"canPost": true,
"email": "cryptic.pug@firebase.com",
"lastPost": 14776667681,
"profile_picture": "https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg",
"username": "Cryptic Pug"
}
}
}