即使操作成功完成,Firebase仍显示权限被拒绝
Firebase在登录时和我尝试在数据库中添加新元素时向我显示了来自bellow的消息,但操作仍然完成。数据已到达Firestore,我的用户已登录,但在控制台中,我收到有关权限被拒绝的消息即使操作成功完成,Firebase仍显示权限被拒绝,firebase,google-cloud-firestore,firebase-security,Firebase,Google Cloud Firestore,Firebase Security,Firebase在登录时和我尝试在数据库中添加新元素时向我显示了来自bellow的消息,但操作仍然完成。数据已到达Firestore,我的用户已登录,但在控制台中,我收到有关权限被拒绝的消息 index.cjs.js:15024 Uncaught (in promise) Error: PERMISSION_DENIED: Permission denied at index.cjs.js:15024 at exceptionGuard (index.cjs.js:798)
index.cjs.js:15024 Uncaught (in promise) Error: PERMISSION_DENIED: Permission denied
at index.cjs.js:15024
at exceptionGuard (index.cjs.js:798)
at Repo.callOnCompleteCallback (index.cjs.js:15013)
at index.cjs.js:14771
at index.cjs.js:13825
at PersistentConnection.onDataMessage_ (index.cjs.js:13875)
at Connection.onDataMessage_ (index.cjs.js:13007)
at Connection.onPrimaryMessageReceived_ (index.cjs.js:13000)
at WebSocketConnection.onMessage (index.cjs.js:12879)
at WebSocketConnection.appendFrame_ (index.cjs.js:12407)
at WebSocketConnection.handleIncomingFrame (index.cjs.js:12468)
at WebSocket.mySock.onmessage (index.cjs.js:12340)
(anonymous) @ index.cjs.js:15024
exceptionGuard @ index.cjs.js:798
Repo.callOnCompleteCallback @ index.cjs.js:15013
(anonymous) @ index.cjs.js:14771
(anonymous) @ index.cjs.js:13825
PersistentConnection.onDataMessage_ @ index.cjs.js:13875
Connection.onDataMessage_ @ index.cjs.js:13007
Connection.onPrimaryMessageReceived_ @ index.cjs.js:13000
(anonymous) @ index.cjs.js:12879
WebSocketConnection.appendFrame_ @ index.cjs.js:12407
WebSocketConnection.handleIncomingFrame @ index.cjs.js:12468
mySock.onmessage @ index.cjs.js:12340
index.cjs.js:15024 Uncaught (in promise) Error: PERMISSION_DENIED: Permission denied
at index.cjs.js:15024
at exceptionGuard (index.cjs.js:798)
at Repo.callOnCompleteCallback (index.cjs.js:15013)
at index.cjs.js:14876
at index.cjs.js:13750
以下是我在Firestore的规则:
// Allow read/write access on all documents to any user signed in to the application
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
您的安全规则要求经过身份验证的用户进行查询。错误消息表明您在用户登录时没有执行查询。您的代码应该等到用户登录后再进行查询。通常用一只手来做