使用Firebase时 发生错误,如下所示。
redux-firestore侦听器错误:FirebaseError:缺少权限或权限不足。
当前的Firestore规则
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth.uid != null;
}
}
}
如果更改Firestore规则,它将起作用。
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
出什么问题了?
答案 0 :(得分:2)
您的第一条安全规则要求用户使用Firebase Auth登录。如果不是这种情况,则该错误是有道理的。
您的第二条规则向互联网上的任何人打开查询。实际上,它允许所有读写操作,这是一个相当重要的安全问题。
我强烈建议您learn how security rules work,并且如果安全性放在首位,请也使用Firebase Authentication,以便您确定谁可以读写数据库。