Email Token Expiring After 15 mins - Asp Identity 2.0 API

百般思念 提交于 2019-12-18 11:45:45

问题


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?


回答1:


Change the code in the Create method(App_Start\IdentityConfig.cs file).

if (dataProtectionProvider != null)
 {
    manager.UserTokenProvider =
       new DataProtectorTokenProvider<ApplicationUser>
          (dataProtectionProvider.Create("ASP.NET Identity"))
          {                    
             TokenLifespan = TimeSpan.FromHours(3)
          };
 }

source: http://www.asp.net/identity/overview/features-api/account-confirmation-and-password-recovery-with-aspnet-identity



来源:https://stackoverflow.com/questions/27152612/email-token-expiring-after-15-mins-asp-identity-2-0-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!