Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValidateLifetime JWT #94

Open
alfonsovgs opened this issue Jul 23, 2024 · 0 comments
Open

ValidateLifetime JWT #94

alfonsovgs opened this issue Jul 23, 2024 · 0 comments

Comments

@alfonsovgs
Copy link

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,
    };
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant