flutter - 调用者没有执行指定操作的权限

我正在尝试构建一个包含聊天功能的应用程序,但出现错误消息:

[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: [cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.

我的 Firebase 规则:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
  
match /users/{uid}{
allow write: if request.auth != null && request.auth.uid == uid;
}

match /users/{uid}{
allow read: if request.auth != null;
}

match /chat/{document=**}{
    allow read: if request.auth != null;
    }
  }
}

enter image description here

如上图所示,当我写消息并发送时,它没有出现在屏幕上,错误信息写在终端

最佳答案

您可以按照以下规则制定规则。也是安全的

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

https://stackoverflow.com/questions/66240201/

相关文章:

ajax - ASP.NET Core Razor ajax POST 请求数据对象为空

asp.net - 将具有策略的授权应用于 asp.net core 中命名空间内的所有 Contr

sql - 两列上的复合非空约束

go 1.16 embed - strip 目录名

java - 输出最大分数

r - 按组选择每个连续运行中的第一行

python - 条件运算符不匹配

javascript - React App - 我的警告窗口出现两次

c++ - 自动类型检测是否只查看一个语句

swift - 如何使用 SwiftUI 中的扩展将 Hashable 协议(protocol)添加