MVC OpenId Microsoft Idenity GetExternalLoginInfoAsync null
<p>I am trying to implement Microsoft Identity in my existing Azure Cloud service. The Cloud Service consists of a ASP.NET MVC 5 web role.
I am using the UseOpenIdConnectAuthentication middleware.</p>

<p>The application succesfully redirects the user to the Microsoft signin page. After that the application just prompts back to the application's login page, and the user is not logged in. When I check the ExternalLoginCallback function in the AccountController, the value of <code>AuthenticationManager.GetExternalLoginInfoAsync()</code> returns null. The code in Startup.Auth.cs is:</p>

<pre><code>public void ConfigureAuth(IAppBuilder app)
{
    app.CreatePerOwinContext(ApplicationDbContext.Create);
    app.CreatePerOwinContext&lt;ApplicationUserManager&gt;(ApplicationUserManager.Create);
    app.CreatePerOwinContext&lt;ApplicationSignInManager&gt;(ApplicationSignInManager.Create);

    app.UseCookieAuthentication(new CookieAuthenticationOptions
    {
        AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
        LoginPath = new PathString("/Account/Login"),
        Provider = new CookieAuthenticationProvider
        {
            OnValidateIdentity = SecurityStampValidator.OnValidateIdentity&lt;ApplicationUserManager, ApplicationUser&gt;(
                validateInterval: TimeSpan.FromMinutes(30),
                regenerateIdentity: (manager, user) =&gt; user.GenerateUserIdentityAsync(manager))
        }
    });
    app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
    app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
    {
        Authority = "https://login.microsoft.com/common/v2.0",
        ClientId = "-----client id is here------",
        Scope = "openid email",
        RedirectUri = "https://localhost",
        TokenValidationParameters = new TokenValidationParameters
        {
            ValidateIssuer = false
        }
    }
    );
}
</code></pre>

<p>I checked if the token was available in the <code>OnAuthorizationCodeReceived</code> event, and it was. <code>notification.JwtSecurityToken</code> contained the requested information.</p>

<p>Does somebody have any clue why the GetExternalLoginInfoAsync() is returning a null value, while the token is actually received by the application?</p>