title: Azure AD API authentication : invalid_token, The audience 'https://webpubsub.azure.com/' is invalid
body: <p>I'm new in Azure, I try to connect to my first webpubsub service with curl from my webserver :</p>
  <pre><code>curl -X POST -d 'grant_type=client_credentials
  &amp;client_id=d13xxxxx
  &amp;client_secret=zi5xxxxx
  &amp;resource=https%3A%2F%2Fwebpubsub.azure.com%2F' 
  https://login.microsoftonline.com/a93xxxxx/oauth2/token
  </code></pre>
  <p>and obtain :</p>
  <pre><code>{
  &quot;token_type&quot;:&quot;Bearer&quot;,
  &quot;expires_in&quot;:&quot;3599&quot;,
  &quot;ext_expires_in&quot;:&quot;3599&quot;,
  &quot;expires_on&quot;:&quot;1648200799&quot;,
  &quot;not_before&quot;:&quot;1648196899&quot;,
  &quot;resource&quot;:&quot;https://webpubsub.azure.com/&quot;,
  &quot;access_token&quot;:&quot;eyJxxxxx&quot;
  }
  </code></pre>
  <p>But when I want to use this token :</p>
  <pre><code>curl -I -H &quot;Authorization: Bearer eyJxxxxx&quot;
  https://my-resource.webpubsub.azure.com/api/hubs/myHub1/users/user1?api-version=2021-10-01
  </code></pre>
  <p>I only obtain :</p>
  <pre><code>HTTP/2 401 
  www-authenticate: Bearer error=&quot;invalid_token&quot;,
  error_description=&quot;The audience 'https://webpubsub.azure.com/' is invalid&quot;
  </code></pre>
  <p>I'm lost in technical vocabulary in AD documentation and I don't understand what is wrong or missing.</p>
  <p>Anyone to help me, please ?</p>