Skip to content

[ BB2-936 ] Adding support for using the refresh token#10

Merged
nbragdon merged 1 commit intomasterfrom
BB2-936_handle_refresh_token
Jan 5, 2022
Merged

[ BB2-936 ] Adding support for using the refresh token#10
nbragdon merged 1 commit intomasterfrom
BB2-936_handle_refresh_token

Conversation

@nbragdon
Copy link
Copy Markdown
Contributor

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?)

Copy link
Copy Markdown
Contributor

@bfausett77 bfausett77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! Nice work!

Copy link
Copy Markdown
Contributor

@JFU-GIT JFU-GIT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

@dtisza1 dtisza1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'))) {

@nbragdon nbragdon merged commit 34a4e75 into master Jan 5, 2022
@nbragdon nbragdon deleted the BB2-936_handle_refresh_token branch January 5, 2022 16:58
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

Successfully merging this pull request may close these issues.

4 participants