title: OAuth 2.0 and Azure Active Directory - error AADSTS90009
body: <p>I'm trying to authorize access to our web application by using OAuth 2.0 and Azure AD. Guide <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code" rel="noreferrer">here</a>.</p>
  
  <p>The user is redirected to similar URL:</p>
  
  <pre><code>https://login.microsoftonline.com/common/oauth2/authorize?
      client_id=d220846b-1916-48d2-888b-9e16f6d9848b&amp;
      response_type=code&amp;
      response_mode=query&amp;
      state=[secure-random]&amp;
      redirect_uri=[my_uri]&amp;
      resource=[my app ID uri taken from app settings]
  </code></pre>
  
  <p>I'm getting the following error then:</p>
  
  <blockquote>
    <p>AADSTS90009: Application 'd220846b-1916-48d2-888b-9e16f6d9848b' is
    requesting a token for itself. This scenario is supported only if
    resource is specified using the GUID based App Identifier.</p>
  </blockquote>
  
  <p>This description does not really help me. I've checked this <a href="https://social.msdn.microsoft.com/Forums/azure/en-US/3de0c14d-808f-47c3-bdd6-c29758045de9/azure-ad-authentication-issue-aadsts90009?forum=WindowsAzureAD#cf3986f5-3422-44d1-bcb7-3a4201f68fa2(I" rel="noreferrer">thread</a>, but I'm still lost.</p>
  
  <p>What does this error mean and which is the GUID based App Identifier? How should the value of the resource look like? Help much appreciated.</p>