我正在尝试通过react原生应用程序来存储文档,但面临以下问题
以下是代码
constructor() {
super();
this.ref = firebase.firestore().collection('todos');
}我们正在触发按钮点击
addTodo() {
this.ref.add({
title: this.state.textInput,
complete: false,
});
}我们正面临着这个问题
错误: Firestore:调用方没有执行指定操作的权限。(firestore/permission-拒绝)。错误: Firestore:调用方没有执行指定操作的权限。(firestore/permission-拒绝)。
发布于 2018-01-09 22:22:45
如果在运行addTodo()时发生此错误,则意味着用户没有写入todos集合的权限。对Firestore数据的访问是通过其server-side security rules控制的。
要简单地允许任何人写入todos,请使用如下规则:
service cloud.firestore {
match /databases/{database}/documents {
match /todos/{document=**} {
allow read, write: if true;
}
}
}但我强烈建议你阅读documentation,这样你就可以写出更安全的规则来满足你的应用程序的需求。
发布于 2020-07-25 17:56:33
在firestore中,如果您获得任何权限denied.This,因为firestore安全规则。
在这种情况下,转到数据库规则部分并将if false更改为if true
allow read, write: if true;
https://stackoverflow.com/questions/48169705
复制相似问题