As per the subject above, we have an ASP.NET MVC 5 application deployed on Azure Websites where the 3rd party Google and Facebook logins work absolutely fine and then fail after about one day (or sometimes two days). The period seems to differ, but the pattern
is always the same.
This only happens on Azure and not locally. When it fails, both Google AND Facebook login fails, restarting the website make it work again.
The code where it fails is the following:
public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
if (loginInfo == null) // fails here where loginInfo is null
When it fails, we seeem to get the external token OK and the external cookie is set OK, it is just when trying to get info for application cookie (internal asp.net identity) that it fails.
Any idea how to overcome this issue?
Thanks in advance
Please try to use the newest package and try again.
# Microsoft WebPages OAuth library 3.2.2
On the other hand, please try it with a new project.
Thanks, but we are already using the latest OAuth library 3.0.0 with the latest 3.2.2 MVC template.
We will however create a new blank project and compare that with our project just in case.
The other weird thing is that it seems to work fine in staging on mywebsite.azurewebsites.com but only fails on the live site which runs under our own domain. We are trying to find out what is different between staging and live other than the fact that live
is running under a real domain name.
Both staging and live run under SSL, although not sure that is relevant. I might pose a question on the Azure Websites forum as well.
Posted on the Azure Websites forum as well (I don’t seem to be able to create a link here as yet):
May be you are missing web.config settings. See this sample for guidance,
the only reason why it would fail after a while in my opinion would be that your cookies aren’t cleared set a clearcookies on your login page and try again.
if this fixes your problem then it’s all about session. sessionid that’s saved in the cookie and it tries to retrieve it upon revisit of the website while the session has already been reset and returns a null value as session so logininfo would be null in