真的需要帮助的家伙,这是我的Firebase存储安全规则
service firebase.storage {
match /b/shoppinglist-XXXX.appspot.com/o {
match /{allPaths=**} {
allow read, write;
}
}
}
这是我的Java代码来获得一个URL链接
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." }}
有人能帮帮我吗?
您可能想从pathRef
下载,而不是storageRef
。不允许从存储树的根目录下载