【发布时间】:2018-11-12 19:28:00
【问题描述】:
我试图让一个简单的规则起作用:如果我的 records 集合中的文档包含与登录用户的电子邮件匹配的电子邮件 (fatherEmail || motherEmail),则允许阅读该文档。不工作 - Missing or insufficient permissions。
每个 Firebase 技术支持推荐的方法来检索经过身份验证的用户的电子邮件地址:
function getUserEmail(){
return request.auth.token.email;
}
这是 Stackblitz: https://stackblitz.com/edit/login-and-match-record-mvce?file=src%2Fapp%2Fauth.service.ts
使用经过验证的电子邮件登录: 用户:devcore2911@gmail.com 通过:foobar 如果您查看控制台,您会看到我上面提到的错误。
我的records 集合包含一个文档,其中包含devcore2911@gmail.com 作为fatherEmail 属性的值,因此文档应该拉起:
【问题讨论】:
标签: firebase google-cloud-firestore firebase-security