我收到错误:Firebase 缺少或权限不足
代码: const demoCollectionRef = this.db.collection('items'); 返回 demoCollectionRef.add(item);
我认为这个错误是因为angularfire2的.add方法。
Firestore 规则:
function isAuthenticated() {
return request.auth.uid != null;
}
function isAdmin() {
return request.auth.token.admin == true;
}
allow create: if isAuthenticated();
allow update, delete: if isAdmin(); // .add method checks update rules
// at the place of checking the create rules, which make it send error.
但是如果我将更新规则更改为: 允许更新、删除:if isAuthenticated();它工作正常
最佳答案
您可以查看此 url 以进行 firebase 数据身份验证
https://firebase.google.com/docs/firestore/security/rules-conditions
关于firebase - Firestore 权限缺失或不足,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52454480/