title: Connect to Azure Blob Storage REST API with axios, Node.js
body: <p>I am trying to connect to the Azure blob storage API with Node.js. I specifically do not want to use the Blob storage SDK, I want to use axios to hit the REST API. I am just trying to do a simple list containers call as specified here: <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/list-containers2" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/rest/api/storageservices/list-containers2</a>. However, I am getting authorization issues.</p>
  <p>Here is my simple axios call:</p>
  <pre><code>try {
    const azureRes = await axios({
      method: 'GET',
      url:
        'https://&lt;accountname&gt;.blob.core.windows.net/?comp=list',
      headers: {
        'x-ms-version': '2017-11-09',
        Authorization:
          'Bearer &lt;access_token&gt;'
      }
    });
    console.log('azureRes', azureRes);
  } catch (err) {
    console.log('err:', err);
  }
  </code></pre>
  <p>However I am getting a response with a 403 status code and the error message:</p>
  <p><code>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.</code></p>
  <p>I am authenticating according to <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-azure-active-directory" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-azure-active-directory</a>, and I am getting my access token from the Azure storage account Access keys tab. Why is my authentication failing?</p>