firestore:PERMISSION_DENIED:权限缺失或不足 [英] firestore: PERMISSION_DENIED: Missing or insufficient permissions

查看:46
本文介绍了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;

注意:这是用于开发目的的快速解决方案,因为它会关闭所有安全性.因此,不建议将其用于生产.

Note: It's quick solution for development purpose only because it will turns off all the security. So, it's not recommended for production.

用于生产:

如果从 firebase 进行身份验证:更改允许读取,写入:if false;request.auth != null;

If authenticated from firebase: Change allow read, write: if false; to request.auth != null;

这篇关于firestore:PERMISSION_DENIED:权限缺失或不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆