标准文档中的 Firebase 规则未验证

时间:2021-04-01 10:01:08

标签: firebase firebase-realtime-database firebase-security

我只是简单地复制并粘贴了本文档中的 firebase 规则来实现令牌撤销。但是,RTDB 规则引擎不允许发布此表达式,请注意下面的屏幕截图..

我已经从此处找到的文档中逐字复制了此规则:https://firebase.google.com/docs/auth/admin/manage-sessions#revoke_refresh_tokens

错误如下图所示: enter image description here

我在这里做错了什么?

1 个答案:

答案 0 :(得分:0)

是的,这看起来行不通。幸运的是,您可以使用更多代码获得相同的结果:

".read": "$user_id === auth.uid 
    && (!root.child('metadata').child(auth.uid).child('revokeTime').exists()
       || auth.token.auth_time > root.child('metadata').child(auth.uid).child('revokeTime').val())

因此,现在不再使用 || 0 技巧来处理没有 revokeTime 的情况,而是针对这种情况有了明确的条件。

我还提交了一个错误以在我们的文档中修复此问题。