每当我尝试在网络应用程序中添加新产品时,我都会收到此错误
ERROR: FirebaseError: Firebase Storage: User does not have permission to access 'products/7WF8Jzbp5aCB8zx9Gm35'. (storage/unauthorized) { "error": { "code": 403, "message": "Permission denied." } }
我的 firebase 安全规则
``rules_version = '2'; 服务云.firestore { 匹配 /databases/{database}/documents {
// This rule allows anyone on the internet to view, edit, and delete
// all data in your Firestore database. It is useful for getting
// started, but it is configured to expire after 30 days because it
// leaves your app open to attackers. At that time, all client
// requests to your Firestore database will be denied.
//
// Make sure to write security rules for your app before that time, or else
// your app will lose access to your Firestore database
//match /{document=**} {
// allow read, write: if request.time < timestamp.date(2020, 4, 21);
//}
match /users/{userId} {
allow read, update: if request.auth.uid != null && request.auth.uid == userId;
allow create: if request.auth.uid != null;
}
match /products/{productId} {
allow create,update,delete: if request.auth.uid != null;
allow read: if true;
}
} }
尝试使用
match /products/{productId} {
allow create,update,delete,write : if request.auth.uid != null;
allow read: if true;
}