当用户使用外部登录提供商(例如 facebook 或 twitter )登录时,我想将他的ExternalIdentity.Name
保存到数据库以显示其用户详细信息页。
我现在拥有的:
[AllowAnonymous]
public ActionResult ExternalLoginCallback(string returnUrl)
{
var loginInfo = AuthenticationManager.GetExternalLoginInfo();
if (loginInfo == null)
return RedirectToAction("Details", new { message = "LinkLoginError" });
// Sign in the user with this external login provider if the user already has a login
var result = SignInManager.ExternalSignIn(loginInfo, isPersistent: false);
...
}
如何扩展/修改/覆盖SignInManager.ExternalSignIn
方法以将loginInfo.ExternalIdentity.Name
保存到dbo.AspNetUserLogins
表?