我添加了我的应用程序的一部分,用户可以上传个人资料图片,但由于某种原因,我得到一个firebase错误,说我/用户没有权限,即使规则显示所有人都可以读取和写入auth不为null。我希望允许已登录的用户进行读/写。
我的firebase存储规则
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
堆栈跟踪:
03-21 11:46:26.851 13033-13033/com.dogboy60.photoblog E/StorageException: The server has terminated the upload session
java.io.IOException: The server has terminated the upload session
at com.google.firebase.storage.UploadTask.zzLb(Unknown Source:21)
at com.google.firebase.storage.UploadTask.zzLa(Unknown Source:58)
at com.google.firebase.storage.UploadTask.run(Unknown Source:259)
at com.google.firebase.storage.zzr.run(Unknown Source:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
03-21 11:46:26.865 13033-13033 / com.dogboy60.photoblog E / Error here :: com.google.firebase.storage.StorageException:用户无权访问此对象。
答案 0 :(得分:0)
您可以像下面的代码一样更改Firebase规则。 仅在条件下删除。
service firebase.storage {
match /b/sacred-age-861.appspot.com/o {
match /{allPaths=**} {
allow read, write;
}
}
}