firestore:PERMISSION_DENIED:缺少权限或权限不足 [英] firestore: PERMISSION_DENIED: Missing or insufficient permissions
本文介绍了firestore:PERMISSION_DENIED:缺少权限或权限不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到错误
gettingdocuments.com.google.firebase.firestore.FirebaseFirestoreException: PERMISSION_DENIED:缺少权限或权限不足.
gettingdocuments.com.google.firebase.firestore.FirebaseFirestoreException: PERMISSION_DENIED: Missing or insufficient permissions.
对于else语句中的以下代码
for the below code on else statement
db.collection("users")
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (DocumentSnapshot document : task.getResult()) {
s(document.getId() + " => " + document.getData());
}
} else {
s("Error getting documents."+ task.getException());
}
}
});
推荐答案
对我来说简单.
转到数据库-> 规则->
Go in Database -> Rules ->
将allow read, write: if
false; 更改为 true;
注意:这完全关闭了数据库的安全性!
不经身份验证即可将其写成世界可写!!!这不是建议在生产环境中使用的解决方案.仅将此用于测试目的.
Making it world writable without authentication!!! This is NOT a solution to recommend for a production environment. Only use this for testing purposes.
这篇关于firestore:PERMISSION_DENIED:缺少权限或权限不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文