I am trying to implement a short code (6digits) for Email Confirmation using Asp.Net Identity Core.
Currently, I am using the existing implementation which is TotpSecurityStampBasedTokenProvider .
Everything works fine, it generates the 6 digit code that I want using this line of code
var token = await _userManager.GenerateUserTokenAsync(user, "EmailTokenProvider", "EmailConfirmation");
,
it also verifies if the code entered is valid or not using this method here var isValid = await _userManager.VerifyUserTokenAsync(user, "EmailTokenProvider", "EmailConfirmation", token);
.
My problem is, when I am trying to call the method await _userManager.ConfirmEmailAsync(user, token);
it says InvalidToken, do I need to implement my own ConfirmEmailAsync? As I also dig deep into it, it calls the SetEmailConfirmedAsync
, do I also need to override the current implementation for that by creating my own custom IUserEmailStore?
Thanks!
Here are some of the sample references: Implement email confirmation with digit code, Custom Verification Code/Token in Asp .Net Identity