title: Azure Active Directory login redirect loop
body: <p>I need to allow users to login through Corp network to access an internal web application.</p>
  
  <p>I've followed all the steps given in the <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/guidedsetups/active-directory-aspnetwebapp" rel="noreferrer">official documentation</a> and it works fine.</p>
  
  <p>However, a strange error that I am getting while logging in is that the authentication pages goes into a redirect loop every other day.</p>
  
  <p>As per now the immediate fix for me is to change the <code>Application/Client ID</code> for the application in my <code>web.config</code> file.</p>
  
  <pre><code>&lt;add key="ClientId" value="Enter_the_Application_Id_here" /&gt;
  &lt;add key="redirectUri" value="Enter_the_Redirect_URL_here" /&gt;
  &lt;add key="Tenant" value="common" /&gt;
  &lt;add key="Authority" value="https://login.microsoftonline.com/{0}/v2.0" /&gt;
  </code></pre>
  
  <p>So as of now, I've got 2 different Applications created in <a href="https://apps.dev.microsoft.com/portal/" rel="noreferrer">Microsoft Identity Platform</a> and I reuse the same <code>App Id</code> (switching them every time one stops working) and as soon as I change the <code>App Id</code>, the login starts working.</p>
  
  <p>Not sure if I am missing something, but haven't found anything related to this exact problem other than a few like <a href="https://github.com/aspnet/Security/issues/219" rel="noreferrer">https://github.com/aspnet/Security/issues/219</a> which does not work for me. And to my understanding and suggestions over the internet if this was a Permission related issue, it should never allow login but it does.</p>