Skip to content

Token expiration check tolerance issue in PersistedAccessTokenCache.GetValidToken #642

@LennartKleymann

Description

@LennartKleymann

Description:
The PersistedAccessTokenCache.GetValidToken method currently checks the JWT token for expiration. However, there is a zero-tolerance window between this check, which causes issues in scenarios where the token becomes invalid for a short duration before the calculated expiration time.

To Reproduce:

  1. Obtain a JWT token.
  2. Wait for the token to approach its expiration time.
  3. Attempt to use the token within the short duration before its calculated expiration time, approximately 300ms.
  4. Observe that the token is not valid.

Expected behavior:
The PersistedAccessTokenCache.GetValidToken method should consider a token invalid if it is used within a reasonable tolerance window before its calculated expiration time, allowing for minor delays in token retrieval and usage.

Additional context:
This issue affects applications where the token provider's response time causes a slight delay in token retrieval, leading to a brief period where the token is incorrectly deemed valid.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions