Firebase Firestore的许可在当地主持人拒绝了,但在线工作良好

发布于 2025-01-31 04:42:14 字数 845 浏览 3 评论 0原文

我正在使用Web应用程序,并且在Localhost上面临着新问题,该问题是firebaseError:缺失或不足的权限,但实时版本的 app 使用相同的firebase firestore可以很好地工作。

这是我的壁垒规则:

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

我必须提到使用限制没有问题。 在这里,您可以看到一个代码块,我提到的错误:

    async getUserData(userUid) {
      const q = query(
        collection(db, "userProfile"),
        where("userUid", "==", userUid)
      );
      const querySnapshot = await getDocs(q);
      querySnapshot.forEach(doc => {
        this.provider.unshift(doc.data().serviceAddress);
      });
    },

I am working on a web app and I faced to new problem on localhost which is FirebaseError: Missing or insufficient permissions but the live version of app that use same firebase firestore works perfectly.

this is my firebase rules:

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

I must mention it that there is no problem with usage limit.
here you can see one block of code which trow the error I mentioned:

    async getUserData(userUid) {
      const q = query(
        collection(db, "userProfile"),
        where("userUid", "==", userUid)
      );
      const querySnapshot = await getDocs(q);
      querySnapshot.forEach(doc => {
        this.provider.unshift(doc.data().serviceAddress);
      });
    },

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初心未许 2025-02-07 04:42:14

请检查您是否在授权域中添加了本地主机。

在身份验证 /授权域中登录Firebase控制台,请确保您看到类似的东西 -

Please check if you have added localhost in Authorized Domains.

Log in Firebase Console, in Authentication / Authorized Domains, make sure you see something like -
enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文