尝试上传照片时,我不断从 firebase 链接收到消息错误,提示我的 React 项目中的 firebase 存储上传出现 400 错误...之前一切正常并成功上传图像,但现在它停止上传照片,出现以下错误,我不知道问题出在哪里...
检查中提示出来的链接
POST https://firebasestorage.googleapis.com/v0/b/xxxxx-****.appspot.com/o?name=usertemp%2F0rdrGK4MRDRptAMCc3mHDveytJv1%2F0rdrGK4MRDRptAMCc3mHDveytJv1.jpg 400 ()
这是链接响应中的错误
{
"error": {
"code": 400,
"message": "Permission denied. Could not access bucket xxxxx-****.appspot.com. Please enable Firebase Storage for your bucket by visiting the Storage tab in the Firebase Console and ensure that you have sufficient permission to properly provision resources."
}
这是我的安全保障
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth!=null;
}
}
}
我仍然尝试改变match
to /b/xxxxx-****.appspot.com/o
仍然没有成功
这是由于缺少权限造成的。您需要检查您是否有
[email protected]
作为具有“存储管理员”角色的成员。如果您没有,请添加它。这样就可以解决这个问题。
以下是如何检查和添加权限的步骤。
- Go to 云控制台
- 导航至存储
- 选择您的存储桶,然后单击显示信息面板。
如果需要,您还可以在 IAM 和管理中添加缺少的权限。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)