First external login attempt redirects back to login action, second one works

前端 未结 3 1413
离开以前
离开以前 2021-01-12 03:51

I\'m using OWIN\'s external authentication providers in my ASP.Net MVC 5 / WebApi 2 project and I\'ve hit a strange problem.

The login workflow is exactly like here

相关标签:
3条回答
  • 2021-01-12 03:59

    Turns out the issue was that my project initially started out as an MVC 4 application which had this in web.config causing the issue:

    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    

    I think both OWIN and Forms authentication was active at the same time.

    0 讨论(0)
  • 2021-01-12 03:59

    As Forms Authentication was added i was being redirected to Login Page. So, removing this code helped

    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    

    but i had to add this line as well

    <system.webServer>
       <validation validateIntegratedModeConfiguration="false" />
       <modules>
          <remove name="FormsAuthentication" />  <-- added this line to remove it completely --> 
       </modules>
    </system.webServer>
    

    hope this helps someone.

    0 讨论(0)
  • 2021-01-12 04:14

    I have the same issue that occurs when i update the ASPNet.Web.Pages.Web.Data 3.1.1 nuget to any later versions. With 3.1.1 it is works! I found the solution here.

    0 讨论(0)
提交回复
热议问题