I've been trying to implement external logins with OWIN in an MVC5 app using a google account.
If I'm already logged into google, clicking the google button in my app is fine and it takes me to my registration page after allowing me access to the logininfo.
If I'm not already logged into google when I click my applications google button, I get prompted to login with Google as expected but the call back receiver doesn't seem to see that I've logged in as logininfo is always null in this scenario in the callback as below...
public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
if (loginInfo == null)
// Code omitted for brevity.
After days of investigation, I have eventually come across the answer. The problem seems to be that after logging into google, it redirects back to the site and doesn't have permission to signin-google so is redirected back to the login page. Not sure why this works if already signed into google though. I discovered this after finding the article...
I added the following to my config file.
<location path="signin-google"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location>
It now works...