电子邮件令牌到期后15分钟 - 天冬氨酸标识2.0 API [英] Email Token Expiring After 15 mins - Asp Identity 2.0 API
问题描述
我现在面临的天冬氨酸点网身份API 2.0 API一个奇怪的问题。
I'm facing a strange issue in Asp Dot Net Identity API 2.0 API.
当一个用户注册,我发送一封确认电子邮件给用户。如果用户注册后的15分钟内确认他/她的帐户,ConfirmEmailAsync的方法似乎是工作。
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.
但后15分钟,如果我尝试来确认的电子邮件地址,我得到一个无效的令牌的错误。
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.
谁能帮助吗?
推荐答案
更改code中的Create方法(App_Start \\ IdentityConfig.cs文件)。
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)
};
}
来源:<一个href=\"http://www.asp.net/identity/overview/features-api/account-confirmation-and-password-recovery-with-aspnet-identity\">http://www.asp.net/identity/overview/features-api/account-confirmation-and-password-recovery-with-aspnet-identity
这篇关于电子邮件令牌到期后15分钟 - 天冬氨酸标识2.0 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!