Azure Active Directory login redirect loop

Cyberpks picture Cyberpks · Mar 19, 2018 · Viewed 8.3k times · Source

I need to allow users to login through Corp network to access an internal web application.

I've followed all the steps given in the official documentation and it works fine.

However, a strange error that I am getting while logging in is that the authentication pages goes into a redirect loop every other day.

As per now the immediate fix for me is to change the Application/Client ID for the application in my web.config file.

<add key="ClientId" value="Enter_the_Application_Id_here" />
<add key="redirectUri" value="Enter_the_Redirect_URL_here" />
<add key="Tenant" value="common" />
<add key="Authority" value="https://login.microsoftonline.com/{0}/v2.0" />

So as of now, I've got 2 different Applications created in Microsoft Identity Platform and I reuse the same App Id (switching them every time one stops working) and as soon as I change the App Id, the login starts working.

Not sure if I am missing something, but haven't found anything related to this exact problem other than a few like https://github.com/aspnet/Security/issues/219 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.

Answer

Cyberpks picture Cyberpks · Mar 26, 2018

Turns out that it was an issue with configuration of the AD.

I went to my Azure App Service > Settings > Authentication/Authorization and created a new AD App, and used the App ID of this app in my web application and it is now working fine.