title: Firebase Storage: Getting Permission denied 400 for public storage
body: <p>I am trying to use the Firebase storage from Android app. In the beginning all worked fine. Now I am getting response:</p>
  
  <pre><code> {  
       "error": {
          "code": 400,
          "message": "Permission denied. Could not access bucket adiglehard.appspot.com. Please enable Firebase Storage for your bucket by visiting the Storage tab in the Firebase Console and ensure that you have sufficient permission to properly provision resources."  
        }
    }
  </code></pre>
  
  <p>Uploading code is:</p>
  
  <pre><code>storage = FirebaseStorage.getInstance("gs://adiglehard.appspot.com/");
  Uri file = Uri.fromFile(new File(mFile.getAbsolutePath()));
  StorageReference storageRef = storage.getReference();
  StorageReference riversRef = storageRef.child("images/" + file.getLastPathSegment());
  uploadTask = riversRef.putFile(file);
  
  // Register observers to listen for when the download is done or if it fails
  uploadTask.addOnFailureListener(new OnFailureListener() {
    @Override
    public void onFailure(@NonNull Exception exception) {
        // Handle unsuccessful uploads
        showToast("error!!!!");
        exception.printStackTrace();
  
    }
  }).addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {
    @Override
    public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
        showToast("success!!!!");
    }
  });
  </code></pre>
  
  <p>The Firestore rules are:</p>
  
  <pre><code>// Anyone can read or write to the bucket, even non-users of your app.
  // Because it is shared with Google App Engine, this will also make
  // files uploaded via GAE public.
  service firebase.storage {
    match /b/{bucket}/o {
      match /{allPaths=**} {
        allow read, write;
      }
    }
  }
  </code></pre>