繁体   English   中英

Firestore权限不足或不足

[英]Missing or insufficient permissions firestore

我收到错误消息: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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM