Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase getDownloadURL Not working Android

Really need help guys, Here is my Firebase Storage Security Rule

service firebase.storage {
  match /b/shoppinglist-XXXX.appspot.com/o {
    match /{allPaths=**} {
      allow read, write;
    }
  }
}

Here is my Java Code to get a URL Link

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);
        }
    });

Here is my Error:

     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."  }}

Can Someone Please Help!

like image 466
JtecX Avatar asked Nov 18 '16 16:11

JtecX


1 Answers

You probably meant to download from pathRef, not storageRef. Downloading from the root of the storage tree is not permitted.

like image 150
Bob Snyder Avatar answered Sep 23 '22 08:09

Bob Snyder