'userManager.FindByIdAsync returns NULL
I dont know why my userManager.FindByIdAsync returns a NULL value when a trying reset my password.
public async Task<bool> ResetPasswordByAdmin(string userId, string newPassword)
{
try
{
var user = await _userManager.FindByIdAsync(userId);
string token = await _userManager.GeneratePasswordResetTokenAsync(user);
var identityResult = await _userManager.ResetPasswordAsync(user, token, newPassword);
return identityResult.Succeeded;
}
catch (Exception)
{
throw;
}
}
EDIT 01 (FindByIdAsync):
public virtual Task<TUser> FindByIdAsync(string userId);
//
// Summary:
// Retrieves the user associated with the specified external login provider and
// login provider key.
//
// Parameters:
// loginProvider:
// The login provider who provided the providerKey.
//
// providerKey:
// The key provided by the loginProvider to identify a user.
//
// Returns:
// The System.Threading.Tasks.Task for the asynchronous operation, containing the
// user, if any which matched the specified login provider and key.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
