I have set up an Identity Server 4 project in .NET Core 2.1, I have everything working but when I use the user manager to generate the reset password token, the token expires after 24 hours, can I change this so it's 48 hours?
My code to send the reset token looks like this:
var code = await _userManager.GeneratePasswordResetTokenAsync(user);
var callbackUrl = url.EmailConfirmationLink(user.Id, code, scheme);
My ConfigureServices looks like this:
services.AddIdentity<ApplicationUser, IdentityRole>(config =>
{
config.SignIn.RequireConfirmedEmail = true;
})
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
Thanks :)
Adding the following code to ConfigureServices() method in Startup.cs class should help you.
services.Configure<DataProtectionTokenProviderOptions>(options =>
options.TokenLifespan = TimeSpan.FromDays(2));
Default Token Lifespan is 24 hours (1 day). Please refer github and TokenOptions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With