Azure Hosted App – Login Redirect Loop
Our Software Development team encountered a weird issue on one of the MVC web based projects. In some cases, if the App is hosted in Azure and authenticated by Azure AD, the user is redirected to Microsoft Online login page. This only happens when the solutions is publish to Azure(Not in the dev environment).
This is a semi-famous bug(Katana Bug #197) in Microsoft Owin implementation. This bug is related to the Cookie handling algorithm and clearing out stored cookies might only be a temporary solution.
I would recommend to follow the bellow article first to check whether it fixes your problem.
If this doesn’t fix your problem, please get and install “Kentor.OwinCookieSaver” from the Nuget package manager in to your project. After installing, please do the following modification in “Startup.Auth.cs” file.
Go to “ConfigureAuth” method.
Make sure that you install the latest package as the old package did not fix my problem. According to the latest package you might be required to change the .NET framework of your project. The latest “Kentor.OwinCookieSaver” Works with .Net Framework 4.6 or higher.