title: Cannot upload object to Google Cloud Storage using signed url and HTTP PUT
body: <p>I'm trying to upload an object to the Google cloud storage, using a <code>signed url</code>. I'm generating the <code>url</code>, using a <code>JAVA</code> method, as follows (with the help of this <a href="https://cloud.google.com/storage/docs/access-control/signing-urls-with-helpers#code-samples" rel="nofollow noreferrer">link</a>):</p>
  <pre><code>public String generatePutObjectSignedUrl(String bucketName, String objectName, String contentType) throws GenericAttachmentException {
          if (!bucketExists(bucketName)) {
              createBucket(bucketName);
          }
          // Define resource
          BlobInfo blobInfo = BlobInfo.newBuilder(BlobId.of(bucketName, objectName)).build();
  
          // Generate signed URL
          Map&lt;String, String&gt; extensionHeaders = new HashMap&lt;&gt;();
          extensionHeaders.put(&quot;Content-Type&quot;, contentType);
  
          return String.valueOf(storage.signUrl(
                  blobInfo,
                  15,
                  TimeUnit.MINUTES,
                  SignUrlOption.httpMethod(HttpMethod.PUT),
                  SignUrlOption.withExtHeaders(extensionHeaders),
                  SignUrlOption.withV4Signature()));
  
      }
  </code></pre>
  <p>I'm also getting an upload url, as follows:</p>
  <pre><code>https://storage.googleapis.com/bucket/43fb114d-973e-4157-8a3d-0d479aa5b255/1553.pdf?X-Goog-Algorithm=GOOG4-RSA-SHA256&amp;X-Goog-Credential=storage-dev%40project-name-229712.iam.gserviceaccount.com%2F20200622%2Fauto%2Fstorage%2Fgoog4_request&amp;X-Goog-Date=20200622T181856Z&amp;X-Goog-Expires=900&amp;X-Goog-SignedHeaders=content-type%3Bhost&amp;X-Goog-Signature=27de4c5f8f669ead91cdf2a3cf91485ac272be5357420dc40d75a534834ed300d19098f857c638558624b4500762820002fa99071f35723146c4afca01d5b77f56c90fa63b53598b887d71ef7a49b2bb389ce70bcee11db9f5cff6f6164e9821753ae82651379138b12b46c82c0fee3d8898b45a4b06fd80925a501d036289093fcb94226cfdecd285991ea2a215577321ffc1c1d5f30bfe0e83c1b876351e87240cf17eb940fdb91d813cb8b7988ce09f71e51464728ac58e3d8fdd8d3bb5a279791d87069fc8d3719ad2080886ff931f00e3691fbe85df3f503ab9175da2d5b7d65c3d3412a3f8f9446164682e17dcf64942fa6d2c30a2e173438e186221d5
  </code></pre>
  <p>But, when I try to upload an object, using HTTP PUT on the above URL, using <code>POSTMAN</code>, I get the following error:</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;GOOG4-RSA-SHA256
  20200622T181856Z
  20200622/auto/storage/goog4_request
  086bc1e8dfe17975d9c67a59edcaf003a26631a2451b82a370b0bbaf0a8003be&lt;/StringToSign&gt;
      &lt;CanonicalRequest&gt;PUT
  /bucket/43fb114d-973e-4157-8a3d-0d479aa5b255/1553.pdf
  X-Goog-Algorithm=GOOG4-RSA-SHA256&amp;amp;X-Goog-Credential=storage-dev%40project-name-229712.iam.gserviceaccount.com%2F20200622%2Fauto%2Fstorage%2Fgoog4_request&amp;amp;X-Goog-Date=20200622T181856Z&amp;amp;X-Goog-Expires=900&amp;amp;X-Goog-SignedHeaders=content-type%3Bhost
  content-type:multipart/form-data; boundary=--------------------------707205682373848354360690
  host:storage.googleapis.com
  
  content-type;host
  UNSIGNED-PAYLOAD&lt;/CanonicalRequest&gt;
  &lt;/Error&gt;
  </code></pre>
  <p>It's been a real tough nut to crack. Would really appreciate some help.</p>