Firebase Firestore的许可在当地主持人拒绝了,但在线工作良好
我正在使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请检查您是否在授权域中添加了本地主机。
在身份验证 /授权域中登录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 -
