即使我使用正确的凭据和正确的登录方法登录,然后执行“ this.oidcSecurityService.authorize()”,我仍在对IdentityServer 4进行身份验证的Angular 6项目上工作。方法-auth-oidc-client“我得到一条消息,表明用户未通过身份验证。即使” PasswordSignInAsync“没有显示错误,也好像不起作用。有人知道这可能是什么吗?
登录方法:
public async Task<IActionResult> Login(LoginInputModel model)
{
if (ModelState.IsValid)
{
var result = await _signInManager.PasswordSignInAsync(model.Username, model.Password, model.RememberLogin, lockoutOnFailure: true);
if (result.Succeeded)
{
var user = await _userManager.FindByNameAsync(model.Username);
await _events.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id, user.UserName));
return Ok();
}
;
await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "Usuário ou senha inválidos"));
ModelState.AddModelError("", AccountOptions.InvalidCredentialsErrorMessage);
}
// something went wrong, show form with error
var vm = await BuildLoginViewModelAsync(model);
return Ok(vm);
}