I’m facing a strange issue in Asp Dot Net Identity API 2.0 API.
When an user signs up, I send a confirmation email to the user. And if the user confirms his / her account within 15 mins of signing up, the “ConfirmEmailAsync” method seems to be working.
But after 15 mins, if I try to confirm the email address, I’m getting a “Invalid Token” error.
Is there a way to set the token expiry time?
A really frustrating issue and it’s becoming very hard to troubleshoot.
Can anyone help please?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Change the code in the Create method(App_StartIdentityConfig.cs file).
if (dataProtectionProvider != null)
{
manager.UserTokenProvider =
new DataProtectorTokenProvider<ApplicationUser>
(dataProtectionProvider.Create("ASP.NET Identity"))
{
TokenLifespan = TimeSpan.FromHours(3)
};
}
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0