我正在寫一個asp.net MVC應用程序,並試圖登錄使用Facebook的。Facebook登錄與asp.net的MVC
我創建Facebook的應用程序,並在日誌中縫工作,但是當我回到我不來,我可以將Facebook的accont到電子郵件上我的應用程序的頁面。
在LOGININFO下面的代碼爲空,我被重定向到重新登錄頁面。 我忘了做什麼或在這裏發生了什麼? (我還沒有與Facebook帳戶我與登錄前註冊)
public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
{
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
if (loginInfo == null)
{
return RedirectToAction("Login");
}
// Sign in the user with this external login provider if the user already has a login
var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);
switch (result)
{
case SignInStatus.Success:
return RedirectToLocal(returnUrl);
case SignInStatus.LockedOut:
return View("Lockout");
case SignInStatus.RequiresVerification:
return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = false });
case SignInStatus.Failure:
default:
// If the user does not have an account, then prompt the user to create an account
ViewBag.ReturnUrl = returnUrl;
ViewBag.LoginProvider = loginInfo.Login.LoginProvider;
return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = loginInfo.Email });
}
}