Note that there are some explanatory texts on larger screens.

plurals
  1. POPUT files to Google Cloud Storage (GCS) via Signed URLs
    text
    copied!<p>I am trying to use "signed URLs" to access/upload files to Google Cloud Storage (GCS).</p> <p>Followed the instructions at <a href="https://developers.google.com/storage/docs/accesscontrol#Signing-Strings">https://developers.google.com/storage/docs/accesscontrol#Signing-Strings</a></p> <p>What I did:</p> <ul> <li>Registered a "Web Application" at Google Cloud Console.</li> <li>Generated new private key using the "Generate New Key" at the "Certificate" section of the registered web application screen.</li> <li>Created my string to be signed and sign it using the sample code provided by "How to Sign" section of the page (just minor tweaks to hardcode values for the Java main program). Update: Created a gist for <a href="https://gist.github.com/kctang/2cfdf66c7f11391ae11b">GcsSigner.java</a>.</li> <li>Ensure that the signed string is URL encoded.</li> <li>HTTP headers specified: x-goog-api-version, x-goog-project-id, Content-Type.</li> <li>URL Parameters specified: GoogleAccessId, Signature, Expires.</li> <li>Use Postman (a Chrome extension) to simulate PUT request.</li> </ul> <p>However, I am still getting this (Status: 403 Forbidden):</p> <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt; &lt;Error&gt; &lt;Code&gt;SignatureDoesNotMatch&lt;/Code&gt; &lt;Message&gt;The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.&lt;/Message&gt; &lt;StringToSign&gt;PUT text/plain 1384084959392 x-goog-api-version:2 x-goog-project-id:99999 /mybucket/myfile.txt&lt;/StringToSign&gt; &lt;/Error&gt; </code></pre> <p>Even when I retry by signing the string based on values in "StringToSign", I still get the same error.</p> <p>Read various related postings here but could not find any solution and most of it refers to <code>x-goog-api-version:1</code> while i am using version 2.</p> <p>What am i missing? Any help would be greatly appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload