title: getting "Interaction_required\",\"error_description\":\"AADSTS530031: Access policy does not allow token issuance error when requesting token from ad
body: <p>Suddenly I got an error when getting a token to access SharePoint from the azure ad.</p>
  <pre><code>private async Task&lt;string&gt; AcquireTokenAsync(Uri resourceUri, string username, string password)
          {
              string resource = $&quot;{resourceUri.Scheme}://{resourceUri.DnsSafeHost}&quot;;
  
              var clientId = defaultAADAppId;
              var body = $&quot;resource={resource}&amp;client_id={clientId}&amp;grant_type=password&amp;username={HttpUtility.UrlEncode(username)}&amp;password={HttpUtility.UrlEncode(password)}&quot;;
              using (var stringContent = new StringContent(body, Encoding.UTF8, &quot;application/x-www-form-urlencoded&quot;))
              {
  
                  var result = await httpClient.PostAsync(tokenEndpoint, stringContent).ContinueWith((response) =&gt;
                  {
                      return response.Result.Content.ReadAsStringAsync().Result;
                  }).ConfigureAwait(false);
  
                  var tokenResult = JsonSerializer.Deserialize&lt;JsonElement&gt;(result);
                  var token = tokenResult.GetProperty(&quot;access_token&quot;).GetString();
  
                  return token;
              }
          }
  
  
     ValueKind = Object : &quot;{&quot;error&quot;:&quot;interaction_required&quot;,&quot;error_description&quot;:&quot;AADSTS530031: Access policy does not allow token issuance.\r\nTrace ID: 823cd416-a194-41b9-a7f7-3b00c33aca00\r\nCorrelation ID: 4c304826-338b-46d7-986c-f7cc5d78820a\r\nTimestamp: 2022-03-10 11:50:20Z&quot;,&quot;error_codes&quot;:[530031],&quot;timestamp&quot;:&quot;2022-03-10 11:50:20Z&quot;,&quot;trace_id&quot;:&quot;823cd416-a194-41b9-a7f7-3b00c33aca00&quot;,&quot;correlation_id&quot;:&quot;4c304826-338b-46d7-986c-f7cc5d78820a&quot;,&quot;error_uri&quot;:&quot;https://login.microsoftonline.com/error?code=530031&quot;,&quot;suberror&quot;:&quot;message_only&quot;}&quot;
  </code></pre>
  <p>This is the token result I got. This was working perfectly.Can someone help me to figure this out?</p>