我收到错误: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();效果很好
您可以查看此网址进行 Firebase 数据身份验证
https://firebase.google.com/docs/firestore/security/rules-conditions https://firebase.google.com/docs/firestore/security/rules-conditions
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)