[ BB2-936 ] Adding support for using the refresh token#10
Merged
Conversation
…oken once expired
bfausett77
approved these changes
Dec 17, 2021
Contributor
bfausett77
left a comment
There was a problem hiding this comment.
This looks good! Nice work!
JFU-GIT
approved these changes
Jan 4, 2022
Contributor
JFU-GIT
left a comment
There was a problem hiding this comment.
simulated by break point at access token expiration logic in getBenefitData(...) and shorten the expire interval in seconds 36000 - 360 e.g., and force a execution of refresh call.
works as expected.
dtisza1
approved these changes
Jan 4, 2022
Contributor
dtisza1
left a comment
There was a problem hiding this comment.
Looks good to me!
Also tested by replacing the conditional in src/routes/Data.ts getBenefitData() function with:
if (moment(loggedInUser.authToken.expires_at).isBefore(moment().add(5, 'days'))) {
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds in the use of the refresh token. Checks to see when the access token has expired, and then prior to gathering data it calls the token endpoint with the refresh token to generate a new access token (and refresh token as well).
Currently it is just implemented for EOB since that is the only data we are using.
Will go ahead and move this to the functions that @JFU-GIT created in his PR once that gets merged in.
Also trying to decide if we should add this to the error handler as well (if they get an access denied response, should they try refreshing the token?)