How to get URL from Firebase Storage getDownloadURL
<p>I'm trying to get the "long term persistent download link" to files in our Firebase storage bucket.
I've changed the permissions of this to</p>

<pre><code>service firebase.storage {
  match /b/project-xxx.appspot.com/o {
    match /{allPaths=**} {
      allow read, write;
    }
  }
}
</code></pre>

<p>And my javacode looks like this:</p>

<pre><code>private String niceLink (String date){
    String link;
    // Points to the root reference
    StorageReference storageRef = FirebaseStorage.getInstance().getReference();
    StorageReference dateRef = storageRef.child("/" + date+ ".csv");
    link = dateRef.getDownloadUrl().toString();
    return link;
}
</code></pre>

<p>When I run this I get the uri link that looks something like
<em>com.google.android.gms.tasks.zzh@xxx</em></p>

<p><strong>Question 1.</strong> Can I from this get the download link similar to: <em><a href="https://firebasestorage.googleapis.com/v0/b/project-xxxx.appspot.com/o/20-5-2016.csv?alt=media&amp;token=b5d45a7f-3ab7-4f9b-b661-3a2187adxxxx" rel="noreferrer">https://firebasestorage.googleapis.com/v0/b/project-xxxx.appspot.com/o/20-5-2016.csv?alt=media&amp;token=b5d45a7f-3ab7-4f9b-b661-3a2187adxxxx</a></em></p>

<p>When trying to get the link above I changed the last row before my return, like this:</p>

<pre><code>private String niceLink (String date){
    String link;
    // Points to the root reference
    StorageReference storageRef = FirebaseStorage.getInstance().getReference();
    StorageReference dateRef = storageRef.child("/" + date+ ".csv");
    link = dateRef.getDownloadUrl().getResult().toString();
    return link;
}
</code></pre>

<p>But when doing this i get a 403 error, and the app crashing. The consol tells me this is bc user is not logged in /auth.
"Please sign in before asking for token"</p>

<p><strong>Question 2.</strong> How do I fix this?</p>