I made the method to get a reset token and reset the passport in a single route it works fine for the single route as below:
[HttpGet("ResetPassword")]
[AllowAnonymous]
public async Task<IActionResult> ResetPassword(string userId)
{
var Password = "Random@123";
var user = await _userManager.FindByIdAsync(userId);
var token = await _userManager.GeneratePasswordResetTokenAsync(user);
var resetStatus = await _userManager.ResetPasswordAsync(user, token, Password);
}
But if I separate the GeneratePasswordResetTokenAsync and ResetPasswordAsync into different routes I get an error of invalid token I try dowing URL encoding and all other solutions available but it didn't work I also implemented a custom token handler as suggested by Custom Token Handler. But getting the same error.
CodePudding user response:
I solved it. It is caused by the database. I made configured it with a new database and with a new migration script and it is working now.