Using Google Firebase storage without authentication

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;
    }
  }
}
+4
source share
4 answers

Use the new Firebase storage console at https://console.firebase.google.com . Browse your folders and select the downloaded file. On the File Location tab, this field is called the download URL . Click on it to copy, and you can link to this file on your site.

, .

+7

URL- .

, 5 .

+3

, Google Firebase . , .

0

FireBase

service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write;
    }
  }
}

, .

0

All Articles