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
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.
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.
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.