这是我当前的代码:
async newCollectionRequest({ commit }, data) {
try {
console.log(data);
const location = `/pending-images/${data.collectionName}/${data.image.name}`;
console.log(location);
const storage = getStorage();
const storageRef = ref(storage, location);
// 'file' comes from the Blob or File API
await uploadBytes(storageRef, data.image);
console.log('Uploaded a blob or file!');
return true;
} catch (error) {
throw error.message;
}
},
它似乎起作用了,但只是因为我在try 上传图像时收到了403响应.我不确定为什么我一开始就得到了403,因为我已经在应用程序上实现了身份验证,并且我已经确认用户在try 执行此操作时是登录的.这是我的 firebase 基地规则:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
我不确定这为什么会导致403错误