Identity
Identity copied to clipboard
UserManager<ApplicationUser>.CheckPasswordAsync alway returns false
The code below always produces false (also for valid credentials)
var user = new ApplicationUser { Email = model.Email};
var credentialsCorrect = await _userManager.CheckPasswordAsync(user, model.Password);
// credentialsCorrect is always false
On the other hand, if I use SignInManager<ApplicationUser> instead, the code below works fine
var result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure: false);
var credentialsCorrect = result.Succeeded;
If you check code the SignInManager class it performs a FindByNameAsync to retrieve the user.
https://github.com/aspnet/Identity/blob/acfee9e7e05bfb8ef25c8a7628c200c4cc715ff0/src/Microsoft.AspNet.Identity/SignInManager.cs#L239-L248
@DAllanCarr You are right. I was using it the wrong way. The issue should be closed.