首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PlatformException-权限被拒绝Firebase

PlatformException-权限被拒绝Firebase
EN

Stack Overflow用户
提问于 2021-04-17 18:53:16
回答 1查看 52关注 0票数 0

两天前Firestore停止工作,因为我需要更新安全规则,现在我这样做了,更改很好,我可以再次使用Firebase,但我的函数不再工作。

这是导致异常的代码行:

代码语言:javascript
复制
var ref = await FirebaseFirestore.instance
      .collection("uids")
      .doc("${uid[0] + uid[1]}")
      .collection(uid)
      .doc(uid)
      .get();

Firestore规则:

代码语言:javascript
复制
service cloud.firestore {
  
  match /uids/{twoLetters}/{UserUid}/{anyDoc=**} {
    allow read, write : if true;
  }
}

错误是:

代码语言:javascript
复制
PlatformException (PlatformException(permission-denied, The caller does not have permission
to execute the specified operation., {code: permission-denied,
message: The caller does not have permission to execute the specified operation.,
nativeErrorMessage: Missing or insufficient permissions., nativeErrorCode: 7}, null))

由于规则不一致( allow read, write : if true ),我不明白为什么用户没有权限...

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-31 18:32:16

这可能是因为您可能需要添加时间。例如,您可以这样做:

代码语言:javascript
复制
allow read, write: if request.time < timestamp.date(2021, 6, 1);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67137333

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档