-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce unnecessary cache lookups (#6753)
When looking up tokens in the cache we: 1. Get and parse: idToken, accessToken, refreshToken, account and appMetadata 2. Evaluate the accessToken and if not found or expired throw 3. Catch error and lookup the refreshToken again and attempt to exchange it over the network There's 2 ways to improve this pattern, both addressed in this PR: 1. Don't retrieve the refresh token until it's actually needed (if and when the accessToken needs to be refreshed) 2. Don't retrieve idToken, account and appMetadata until they're needed (accessToken lookup was successful) This saves 1 cache lookup on all calls and an additional 3 cache lookups on calls that fail to return an access token from the cache
- Loading branch information
Showing
4 changed files
with
59 additions
and
86 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@azure-msal-common-5d3e5b0c-ebb6-4c61-b410-108529331ca9.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Don't lookup tokens until they are needed", | ||
"packageName": "@azure/msal-common", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters