title: Cannot access Azure DevOps API using PAT in cURL command in Bash script
body: <p>I have a script that uses the Azure DevOps API to retrieve every work item in a query. Then it retrieves the metadata for each work item. It requires a PAT. Until today the PAT has worked. I believe it is expired. I created a new PAT, but every attempt to retrieve the same information is unauthorized (401).</p>
  <p>The cURL command in my script that worked until now:</p>
  <pre><code>ado_token={username@company.com:PAT, all Base-64 encoded as one string}
  
  curl -X GET -H &quot;Authorization: Basic $ado_token&quot; -H 'Cache-Control: no-cache' &quot;https://dev.azure.com/{company}/{project}/_apis/wit/wiql/{query ID}?api-version=5.1&quot;
  </code></pre>
  <p>Here are the facts:</p>
  <ul>
  <li>Going to the URL directly in the browser succeeds.</li>
  <li>The new token is in the same project as the URL.</li>
  <li>The new token has full access.</li>
  </ul>
  <p><a href="https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?toc=%2Fazure%2Fdevops%2Forganizations%2Ftoc.json&amp;bc=%2Fazure%2Fdevops%2Forganizations%2Fbreadcrumb%2Ftoc.json&amp;view=azure-devops&amp;tabs=preview-page#use-a-pat-in-your-code" rel="noreferrer">Microsoft documentation on ADO PATs</a> provides this example:</p>
  <pre><code>curl -u username[:{personalaccesstoken}] https://dev.azure.com/{organization}/_apis/build-release/builds
  </code></pre>
  <p>However, when my username and PAT are entered with a URL I know to be correct, it is unauthorized.</p>
  <p>Both in the format of the Microsoft example and the URL I would like to use in my script, these are all unauthorized in all iterations of <code>Bearer</code> and <code>Basic</code>. The URL used works in the browser:</p>
  <ul>
  <li>{username}:{PAT}</li>
  <li>{username}@{company}.com:{PAT}</li>
  <li>Base-64 encoded {PAT}</li>
  <li>Base-64 encoded {username}@{company}.com:{PAT}</li>
  <li>Base-64 encoded pat:{PAT}</li>
  <li>Base-64 encoded {username}:{PAT}</li>
  <li>Base-64 encoded {username}@{company}.com:{PAT}</li>
  </ul>
  <p>I have tried both in the command line and Postman but no added information was provided.</p>
  <p>Am I missing something obvious? The most confusing aspect of this is that the previous PAT worked in this same code. Thank you for any help.</p>