I want to share some json file with all users without a server, and I use the Google Firebase storage service (without user authentication). The code:
FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference storageRef = storage.getReferenceFromUrl("gs://xxxxxx.appspot.com/xxx-main.json");
Task<byte[]> task = storageRef.getBytes(1000000);
while (!task.isComplete())
StaticTools.sleep(100);
byte[] b=task.getResult();
but it throws an exception:
com.google.android.gms.tasks.RuntimeExecutionException: com.google.firebase.storage.StorageException: User does not have permission to access this object.
Storage Rule:
service firebase.storage {
match /b/XXXXXX.appspot.com/o {
match /{allPaths=**} {
allow read, write;
}
}
}
source
share