【问题标题】:Firestore read simulation fails, no highlighted lineFirestore 读取模拟失败,没有突出显示的行
【发布时间】:2019-01-25 15:45:48
【问题描述】:

所以,我通常不会在编写 Firestore 规则时遇到问题,但我不知道为什么这个模拟会失败。

如果你不想关注图片链接:

规则:

service cloud.firestore {
  match /databases/{database} {
    match /server_credentials/{document = **} {
      allow read, write: if false;
    }
    match /users/{user_uid} {
        allow read, write;
        match /signatures/{sig_id} {
          allow read: if request.auth.uid != null  && resource.data.access == "public";
          allow read, write: if request.auth.uid == user_uid;
        }
        match /identity/{credential} {
          allow read, write: if request.auth.uid == user_uid;
        }
    }
    match /signatures/{sig_id} {
        allow read, list;
        allow write: if false;
    }
  }
}

认证详情: Google 作为提供者,foo 作为 uid。

我正在测试对users/foo的简单读取

任何帮助都会非常好。

【问题讨论】:

    标签: google-cloud-firestore firebase-security firebase-console


    【解决方案1】:

    此行不正确:

    match /databases/{database} {
    

    应该是这样的:

    match /databases/{database}/documents {
    

    这个错误导致您的规则根本不适用,并且默认情况下所有访问都被拒绝。

    【讨论】:

      猜你喜欢
      • 2018-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多