title: Microsoft Graph API: Insufficient privileges to complete the operation
body: <h2>Problem</h2>
  
  <p>When generating an access token for Microsoft Graph API via ADAL, Graph API does not accept the token.</p>
  
  <pre><code>{
    "odata.error": {
      "code": "Authorization_RequestDenied",
      "message": {
        "lang": "en",
        "value": "Insufficient privileges to complete the operation."
      }
    }
  }
  </code></pre>
  
  <h2>What the application does</h2>
  
  <p>The application should read all users of a tenant. The application is configured to have <code>User.Read.All</code> privileges. The application consent is granted by the tenant, where the users should be read from - the application does appear with the privileges in Azure Portal.</p>
  
  <h2>What I have so far</h2>
  
  <p>The application worked a few days ago and I changed nothing. Other applications using the same way to authenticate work.</p>
  
  <ul>
  <li>Recreating to AAD application did not help</li>
  <li>Reinstalling the NuGet packages did not help</li>
  <li>Changing the authority from login.windows.net to login.microsoftonline.com did not help</li>
  <li>Token generation does not work with client secrets and not with a certificate</li>
  <li>Decoding the generated JWT token shows the permissions required for the action</li>
  </ul>