Infinite Login Loop with Owin RRS feed

All replies

  • Hello,

    This issue is because of the authentication mode selected(by default) by the MVC 5 Template, which triggers the ReturnUrl Style of redirection that might lead to an infinite loop if not configured correctly.

    To disable OWIN startup discovery,add this key to your webconfig file.
    <add key="owin:AutomaticAppStartup" value="false"/>

    you can also refer this stackoverflow thred:

    Regards DOD...
    Tuesday, December 1, 2015 5:15 PM
  • I'm afraid that's not it. If I add that setting, I'm never redirected to the microsoft azure ad login page. The whole website is supposed to be protected.


    Wednesday, December 2, 2015 1:06 PM
  • Hello JoDan,

    I understand that I could be too late for this. This issue can be caused, if you visit the application without HTTPS. Please refer to the link below as one of the use was able to resolve the issue:


    Syed Irfan Hussain

    Thursday, December 17, 2015 8:01 AM
  • Hello Johan,

    We are experiencing this exact same thing.  Did you ever get it resolved and if so, what were the steps you took?

    TIA...Bob Baldwin
    AKA VSDotNetGuy


    Friday, May 27, 2016 2:06 PM
  • This one solved it for me.  If this is on an App Service Web App, you might require HTTPS.


    HTH, Benjamin

    Wednesday, September 28, 2016 1:00 PM
  • Thank you BenjaminPerkins!


    My issue was caused by the Cookie manager issue where System.Web.Cookies conflicts with OWIN cookies and can cause the OWIN auth to fail.

    The thing that drove me crazy was that the authentication would work once in a while and then fail after closing the browser and re-opening it.   I, too, went ahead and set up a brand new MVC project with the same OWIN Startup.  It worked fine on the brand new project that didn't make use of System.Web.Cookies and Sessions, yet.   I was quite baffled.

    Adding the custom cookie manager in the linked article fixed the issue for me.  I am so relieved.

    Wish I found this earlier, as I have been troubleshooting for hours and hours. 

    Friday, February 17, 2017 4:25 PM
  • Hi,

    is this fix still required in 5.0. It mentions that this was fixed ?

    I have the same problem and its driving me crazy. A re-deploy will work for a while then the redirect starts again. Every day.



    Thursday, October 12, 2017 8:59 AM
  • Just to clarify, have you installed the 5.0 ver and still experiencing login loops? And do let us know if you are receiving any specific error message?


    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

    Tuesday, October 24, 2017 7:10 PM
  • Did you solve this problem? I have tried everything....Same as you it work after redeploy

    CRM Consultant/Business Advisor at Skill AS in Norway
    RockStar365 profile

    Thursday, March 1, 2018 8:12 PM
  • Take a look into this similar discussion thread and GitHub Page for some pointers.


    If you have tried all the suggestions posted in this thread and the issues still persist, for a thorough analysis on this specific issue, you may raise a support ticket as mentioned in the link(s) below, which will help you work closely with the support for speedy resolution:

    How to create an Azure support request or Technical Support for Microsoft Partners


    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

    Saturday, March 3, 2018 9:02 PM