Javascript 无法将文件上载到我的Firebase存储中-错误403禁止

Javascript 无法将文件上载到我的Firebase存储中-错误403禁止,javascript,firebase,firebase-security,firebase-storage,Javascript,Firebase,Firebase Security,Firebase Storage,我试图将文件(图像)上载到firebase存储中,但出现以下错误: 张贴。。。403(禁止) 这是我的代码: var storageRef = firebase.storage().ref('/images/' + file.name); var uploadTask = storageRef.put(file); // Register three observers: // 1. 'state_changed' observer, called any time the state cha

我试图将文件(图像)上载到firebase存储中,但出现以下错误:

张贴。。。403(禁止)

这是我的代码:

var storageRef = firebase.storage().ref('/images/' + file.name);
var uploadTask = storageRef.put(file);

// Register three observers:
// 1. 'state_changed' observer, called any time the state changes
// 2. Error observer, called on failure
// 3. Completion observer, called on successful completion
uploadTask.on('state_changed', function(snapshot){
// Observe state change events such as progress, pause, and resume
// Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded
}, function(error) {
// Handle unsuccessful uploads
}, function() {
// Handle successful uploads on complete
// For instance, get the download URL: https://firebasestorage.googleapis.com/...
var downloadURL = uploadTask.snapshot.downloadURL;
});
我不知道代码是否与我的问题有关,但我还是把它放在了一起。 我想知道这是否是权限问题?

403()错误意味着您没有上传到firebase存储的权限,可能是因为默认权限规则需要您进行身份验证。要修复它,只需更改firebase控制台中的规则:)


例如,要向未经授权的用户授予权限,请将中间行更改为:
allow read,write:if true

它通常会告诉您错误中存在权限问题