I have an angular project that I registered JWT token as the Authentication service to Server-Side Project ASP.Net Core API, something like this
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = "JwtBearer";
options.DefaultChallengeScheme = "JwtBearer";
})
.AddJwtBearer("JwtBearer", jwtBearerOptions =>
{
jwtBearerOptions.TokenValidationParameters =
new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(
Encoding.UTF8.GetBytes(jsonWebToken.Key)),
ValidateIssuer = true,
ValidIssuer = jsonWebToken.Issuer,
ValidateAudience = true,
ValidAudience = jsonWebToken.Audience,
ValidateLifetime = true,
ClockSkew = TimeSpan.FromMinutes(
jsonWebToken.MinutesToExpiration)
};
});
}
and I defined ClockSkew (or MinutesToExpiration) for 15 minutes, So this JWT token always be expired after 15 minutes regardless that user works on application (active) or not (no interactive).
but I just looking for a solution that jwt token get expired after 15 minutes that user not active (no any interactive with UI)
So I think it means some how renew the expiration time for more (for next) 15 minutes, but I can not handle it.
So my question is, how I can renew/modify the expiry time in front-end token (that I Stored it on Local Storage) after each request response from server.
Thank you in advance for your help in this matter.