I'm learning asp.net mvc.I'm trying to do sample application with visual studio mvc template. Login system ok for google but i have problem about signing with facebook account. At the first step is done. I'm redirected Associate your Facebook account page. When i entered my Username and click the button i'm getting Object reference not set to an instance of an object for "info" variable at the blow code.
public async Task<ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
{
if (User.Identity.IsAuthenticated)
{
return RedirectToAction("Manage");
}
if (ModelState.IsValid)
{
// Get the information about the user from the external login provider
var info = await AuthenticationManager.GetExternalLoginInfoAsync();
if (info == null)
{
return View("ExternalLoginFailure");
}
var user = new ApplicationUser() { UserName = model.UserName };
var result = await UserManager.CreateAsync(user);
if (result.Succeeded)
{
result = await UserManager.AddLoginAsync(user.Id,info.Login);
if (result.Succeeded)
{
await SignInAsync(user, isPersistent: false);
return RedirectToLocal(returnUrl);
}
}
AddErrors(result);
}
ViewBag.ReturnUrl = returnUrl;
return View(model);
}
I had the same exact issue and solved it by updating the Facebook Nuget Packet. After some research I finally found out the solution thanks to the information given in this StackOverflow question&answer.