背景:
我一直在这里Identity-Sample使用微软团队提供的项目:
我已将Identity-Sample项目和预发布 nuget 包集成到现有项目中,该项目以前使用最新稳定版本的 Identity。
问题:
尝试 2FA 时,在Account/SendCode方法内部会调用GetVerifiedUserIdAsync() ,这是Microsoft.AspNet.Identity.Owin.SignInManager 类的一部分。(在这里查看完整代码)
GetVerifiedUserIdAsync()正在返回 null(即,即使我使用 1 个因素登录,它也找不到经过验证的用户。)我相信它没有找到正确的 cookie。
当我运行该Identity-Sample应用程序时,我的浏览器显示_RequestVerificationTokenAND TwoFactorCookie& 一切正常。
当我运行自己的应用程序时,我的浏览器只显示_RequestVerificationTokencookie 并且我得到了null.
问题:(如果 cookie 是问题)
SignInManager.PasswordSignInAsync(...)当调用方法时(内部) ,如何让我的应用程序正确设置 cookie Account/Login?