0
私はASP.NET MVCアプリケーションでFaceBookログインを実装しようとしています。それはSignInManager.ExternalSignInAsync(loginInfo, isPersistent: false)
を実行しようとFacebookのログインがASP.NET MVCの失敗を返します
毎回、それはここではコード -
Startup.Auth.cs
app.UseFacebookAuthentication(
appId: Social_NetworkBLL.FaceBook_AppID,
appSecret: Social_NetworkBLL.FaceBook_SecretID
);
AccountController
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult ExternalLogin(string provider, string returnUrl)
{
// Request a redirect to the external login provider
return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }));
}
[AllowAnonymous]
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:
return RedirectToAction("Login");
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 });
ExternalLoginConfirmationViewModel vm = new ExternalLoginConfirmationViewModel { Email = loginInfo.Email };
//return RedirectToAction("ExternalLoginConfirmation", new { model = vm, returnUrl = returnUrl });
return await ExternalLoginConfirmation(vm, returnUrl);
}
}
だ
Failure
を返します。