title: Firebase Storage error: error getting token
body: <p>I am building an android app which allows users to upload pictures to firebase storage. I am still in development mode so I set up my storage rules to public. When the user selects a picture to upload, the file is not uploaded but the download URL is returned. Logcat shows the following error</p>
  
  <pre><code>E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
  </code></pre>
  
  <p>And here is my storage rules</p>
  
  <pre><code>service firebase.storage {
    match /b/{bucket}/o {
      match /{allPaths=**} {
        allow read, write;
      }
    }
  }
  </code></pre>
  
  <p>And my android java code:</p>
  
  <pre><code>private void uploadPic() {
  StorageReference mStorageRef = FirebaseStorage.getInstance().getReference();
          Uri fileUrl = Uri.fromFile(new File(filePath));
          String fileExt = MimeTypeMap.getFileExtensionFromUrl(fileUrl.toString());
          final String fileName = UUID.randomUUID().toString()+"."+fileExt;
          StorageReference profilePicsRef = mStorageRef.child("profile_pics/"+fileName);
          profilePicsRef.putFile(fileUrl)
                  .addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {
                      @Override
                      public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                          // Get a URL to the uploaded content
                          Uri downloadUrl = taskSnapshot.getDownloadUrl();
                        Log.d("DOWNLOAD_URL", downloadUrl.toString());
  
                      }
                  })
                  .addOnFailureListener(new OnFailureListener() {
                      @Override
                      public void onFailure(@NonNull Exception exception) {
                          // Handle unsuccessful uploads
                          // ...
                          Toast.makeText(getApplicationContext(), "Error: "+exception.toString(), Toast.LENGTH_LONG).show();
  
                      }
                  });
  }
  </code></pre>
  
  <p>Any help will be greatly appreciated.</p>
  
  <p>UPDATE</p>
  
  <p>I have narrowed down the problem: I have two folders in storage, I can upload to the "Videos" folder, but not to the "profile_pics" folder or any other folder. Why is this happening?</p>