I have the following code that ensures the Token lifetime span for email verification tokens expire after 14 days :-
if (Startup.DataProtectionProvider != null)
If you don't want to override the UserManager
class, you can always grab the token after creation and adjust the ExpirationDate
manually. For example, we do this in our e-mail sending logic (always refresh the token for another 24 hours if you re-send the e-mail):
// Token already created
UserToken userToken = db.UserTokens.Where(t => t.UserId == user.Id && f.IsActive).FirstOrDefault();
userToken.ExpirationDate = DateTime.Now.AddHours(24);