title: AADSTS65001: The user or administrator has not consented to use the application with ID '[Application Id]'
body: <p>I am trying to embed power bi reports in my ASP.NET MVC application, In <code>AAD</code>, I have granted admin permissions to all the Power BI API and Graph API (User permissions specifically), but I keep getting this same error when trying to authenticate. I have set the <code>allowPublicClient</code> to true in the <code>manifest</code> as well.</p>
  
  <p>Below is part of the code, but errors on the <code>authenticationResult</code> part:</p>
  
  <pre><code>    private static readonly string Username = ConfigurationManager.AppSettings["pbiUsername"];
      private static readonly string Password = ConfigurationManager.AppSettings["pbiPassword"];
      private static readonly string AuthorityUrl = ConfigurationManager.AppSettings["authorityUrl"];
      private static readonly string ResourceUrl = ConfigurationManager.AppSettings["resourceUrl"];
      private static readonly string ApplicationId = ConfigurationManager.AppSettings["applicationId"];
      private static readonly string ApiUrl = ConfigurationManager.AppSettings["apiUrl"];
      private static readonly string WorkspaceId = ConfigurationManager.AppSettings["workspaceId"];
      private static readonly string ReportId = ConfigurationManager.AppSettings["reportId"];
      private static readonly string ReportId2 = ConfigurationManager.AppSettings["reportId2"];
  
          var result = new EmbedConfig();
          try
          {
              result = new EmbedConfig { Username = username, Roles = roles };
              var error = GetWebConfigErrors();
              if (error != null)
              {
                  result.ErrorMessage = error;
                  return View(result);
              }
  
              // Create a user password cradentials.
              var credential = new UserPasswordCredential(Username, Password);
  
              // Authenticate using created credentials
              var authenticationContext = new AuthenticationContext(AuthorityUrl);
              var authenticationResult = await authenticationContext.AcquireTokenAsync(ResourceUrl, ApplicationId, credential);
  </code></pre>
  
  <p>Besides for the <code>applicationId</code>, <code>workspaceId</code> and <code>reportIds</code>, I am using the following in my <code>web.config</code>:</p>
  
  <pre><code>&lt;add key="authorityUrl" value="https://login.windows.net/common/oauth2/authorize/" /&gt;
  &lt;add key="resourceUrl" value="https://analysis.windows.net/powerbi/api" /&gt;
  &lt;add key="apiUrl" value="https://api.powerbi.com/" /&gt;
  </code></pre>
  
  <p>What else can I be missing that I still need?</p>