title: administrator has not consented to use the application -- Azure AD
body: <p>I am trying to obtain a token from Azure AD from Python client application. I want users to seamlessly authenticate with just a username and password (client_id / secret will be embedded in the app). I registered my app and given it all permissions and hit the "grant permissions" button in the new portal according to this post:</p>
  
  <p><a href="https://stackoverflow.com/questions/40109711/the-user-or-administrator-has-not-consented-to-use-the-application-send-an-int">The user or administrator has not consented to use the application - Send an interactive authorization request for this user and resource</a> </p>
  
  <p>I am sending an http post to:</p>
  
  <pre><code>https://login.microsoftonline.com/{tenant_id}/oauth2/token
  </code></pre>
  
  <p>with the following data:</p>
  
  <pre><code>headers = {
      "Content-Type": "application/x-www-form-urlencoded"
  }
  
  body = "resource={0}&amp;grant_type=password&amp;username={1}&amp;password={2}&amp;client_id={3}&amp;client_secret={4}&amp;scope=openid".format(app_id_uri,user,password,client_id,client_secret)
  </code></pre>
  
  <p>I cannot seem to get past this error no matter what I try:</p>
  
  <pre><code>b'{"error":"invalid_grant","error_description":"AADSTS65001: The user or administrator has not consented to use the application with ID \'078c1175-e384-4ac7-9116-efbebda7ccc2\'. Send an interactive authorization request for this user and resource.
  </code></pre>
  
  <p>Again, my goal:</p>
  
  <p>User enters user / pass and nothing else. App sends user / pass / client_id / client_secret, obtains token. </p>