代码之家  ›  专栏  ›  技术社区  ›  ImDarkk

FirebaseError:权限缺失或不足。使用getDocs()

  •  0
  • ImDarkk  · 技术社区  · 2 年前

    我试着阅读前两个答案,但似乎没有一个与我目前掌握的答案有相同的规则。

    当我尝试调用getDocs()函数时(使用react)

    let userInfo = await getDoc(doc(db, chargerInfo.userRef));
    

    FirebaseError: Missing or insufficient permissions. 我该怎么做才能不出现这个错误?以下是我的规则

    match /devices/{id} {
            allow read: if request.auth != null;
            allow update: if request.auth != null;
        }
        ```
    
    1 回复  |  直到 2 年前
        1
  •  0
  •   Raphael Rafatpanah    2 年前

    您可以更改为:

     ...
     allow read: if true;
     allow update: if true;
     ...