真的需要帮助人员,这是我的Firebase存储安全规则
service firebase.storage {
match /b/shoppinglist-XXXX.appspot.com/o {
match /{allPaths=**} {
allow read, write;
}
}
}
以下是获取URL链接的Java代码
storageRef = FirebaseStorage.getInstance().getReference();
pathRef = storageRef.child("MyBook.pdf");
storageRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
Log.d(tag, "MyDownloadLink: " + uri);
}
});
这是我的错误:
StorageException has occurred.
User does not have permission to access this object.
{ "error": { "code": 403, "message": "Developer credentials required." }}
java.io.IOException: { "error": { "code": 403, "message": "Developer credentials required." }}
有人可以帮忙!
答案 0 :(得分:12)
您可能打算从pathRef
下载,而不是storageRef
。不允许从存储树的根目录下载。