我遇到错误: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.
但是,如果我将更新规则更改为: 允许更新,删除:如果isAuthenticated();效果很好
答案 0 :(得分:-1)
您可以检出此URL以进行Firebase数据认证
https://firebase.google.com/docs/firestore/security/rules-conditions