Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This probably is a bug in identity OWIN extension code. I can't repro the issue as my facebook payload always returns a username field in json, which is missing from your fb response. I am not quite sure why it's not there.</p> <p>The code in identity owin extension method doesn't have a null check for the identity's name claim which is same as the username field. We have filed a bug for it internally.</p> <p>In order to workaround this issue, could you try replacing your ExternalLoginCallback method with following code:</p> <pre><code> [AllowAnonymous] public async Task&lt;ActionResult&gt; ExternalLoginCallback(string returnUrl) { var result = await AuthenticationManager.AuthenticateAsync(DefaultAuthenticationTypes.ExternalCookie); if (result == null || result.Identity == null) { return RedirectToAction("Login"); } var idClaim = result.Identity.FindFirst(ClaimTypes.NameIdentifier); if (idClaim == null) { return RedirectToAction("Login"); } var login = new UserLoginInfo(idClaim.Issuer, idClaim.Value); var name = result.Identity.Name == null ? "" : result.Identity.Name.Replace(" ", ""); // Sign in the user with this external login provider if the user already has a login var user = await UserManager.FindAsync(login); if (user != null) { await SignInAsync(user, isPersistent: false); return RedirectToLocal(returnUrl); } else { // If the user does not have an account, then prompt the user to create an account ViewBag.ReturnUrl = returnUrl; ViewBag.LoginProvider = login.LoginProvider; return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { UserName = name }); } } </code></pre> <p>The code will set default user name as empty when there is no username back from facebook/google. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload