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

Discard tokens acquired after current time #3786

Merged
merged 6 commits into from Jun 28, 2021

Conversation

tnorling
Copy link
Collaborator

If a user turns back their system clock after a token is acquired they can potentially prolong the amount of time that MSAL will return a cached token to them even though the token may no longer be valid. This PR fixes this behavior by comparing the token cachedAt time to the current time and forcing a refresh if the current time is earlier than the cached at time. This is in accordance with the unified cache schema spec.

Fixes #3206

@github-actions github-actions bot added the msal-common Related to msal-common package label Jun 22, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jun 22, 2021

Codecov Report

Merging #3786 (61ea5ae) into dev (ec037f4) will not change coverage.
The diff coverage is n/a.

Flag Coverage Δ *Carryforward flag
msal-angular 95.65% <ø> (ø)
msal-browser 84.32% <ø> (ø)
msal-common 82.24% <ø> (ø)
msal-core 73.02% <ø> (ø) Carriedforward from e829479
msal-node 80.03% <ø> (ø)
msal-react 93.77% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
lib/msal-common/src/client/SilentFlowClient.ts 94.59% <ø> (ø)

@tnorling tnorling added this to the @azure/msal-common@4.3.1 milestone Jun 22, 2021
@tnorling tnorling merged commit 60af87b into dev Jun 28, 2021
@tnorling tnorling deleted the discard-tokens-acquired-after-clock branch June 28, 2021 23:11
@ghost
Copy link

ghost commented Jun 29, 2021

🎉@azure/msal-common@v4.4.0 has been released which incorporates this pull request.:tada:

We recommend upgrading to the latest version of @azure/msal-browser or @azure/msal-node to take advantage of this change.

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
msal-common Related to msal-common package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Access token returned by PublicClientApplication.acquireTokenSilent is sometimes expired
4 participants