title: How to generate reference url for Google Cloud Storage image objects using java
body: <p>I want to generate an URL for accessing the images in the bucket in Google Cloud Storage, as I want to reference it in img src tag of html. The reason is that we don’t store the image in server.</p>
  
  <p>How can I achieve the following using java?</p>
  
  <ul>
  <li>Generate URL to reference the image in my bucket of Google Cloud Storage, <code>https://storage.cloud.google.com/my-bucket-name/myImage.jpg</code>.</li>
  <li>This URL could be used to get the reference to src of img tag
  but the problem is only the ones who are signed in to google are able to view else it would ask for sign in first.</li>
  <li><p>But what I observed is when I paste the above url in the browser, I find that the URL gets changed to some random url like below, and with this below url anybody can view the image without sign in and I feel if I could generate this URL using java I may be able to resolve the problem.</p></li>
  <li><p>URL is as below (random fake URL)</p></li>
  </ul>
  
  <p><code>https://00e9e544fb-apidata.googleusercontent.com/download/storage/v1/b/my-bucket-name/o/myImage.jpg?qk=AD5-vreOG-Y-RsJ0DZuI--owy_O_cx1RQy_Ya_kn0A_T-i-T-3xhg</code></p>