Skip to content

ValidateLifetime JWT #94

@alfonsovgs

Description

@alfonsovgs

Hi! 👋

I made a modification so that the token expiration time is 1 minute, but the token is still valid.

 var jwtToken = handler.CreateJwtSecurityToken(
     _issuer,
     audience: null,
     identity,
     notBefore: DateTime.Now,
     expires: DateTime.Now.AddMinutes(1), // 👈 updated
     issuedAt: DateTime.Now,
     _jwtSigningCredentials);

I'm not sure if I need to configure this, but when I do, it throws this error:
Bearer error="invalid_token",error_description="The signature key was not found"

builder.Services.AddAuthentication().AddJwtBearer(options =>
{
    options.TokenValidationParameters = new TokenValidationParameters
    {
        ValidateLifetime = true,
    };
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions