-
Notifications
You must be signed in to change notification settings - Fork 9
TechDebt: useAxios 401/403 Request Retry #1079
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
Conversation
… token has expired, but your refresh token is still valid.
|
Openshift URLs for the PR Deployment: |
Codecov Report
@@ Coverage Diff @@
## dev #1079 +/- ##
==========================================
+ Coverage 64.31% 64.35% +0.03%
==========================================
Files 440 440
Lines 13501 13512 +11
Branches 2147 2151 +4
==========================================
+ Hits 8683 8695 +12
+ Misses 4288 4287 -1
Partials 530 530
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
Openshift URLs for the PR Deployment: |
|
Kudos, SonarCloud Quality Gate passed!
|
KjartanE
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worked on local 🐈
* Add retry mechanic to useAxios to handle the case where your keycloak token has expired, but your refresh token is still valid.








Links to Jira Tickets
n/a
Description of Changes
Add retry mechanic to useAxios to handle the case where your keycloak token has expired while working in the APP.
This can occur if you sit on an App page for longer than 5 minutes, without interacting with the api. In this case, the token will have quietly expired (5 minutes in Standard realm), and your next http request is guaranteed to fail.
Updated useAxios so that if the response fails, and the status is specifically a 401 or 403, then it attempts to refresh the token, and if it is successfully refreshed, re-run the last failed request.
Add useAxios tests.
Testing Notes
Let your token expire (wait 5 minutes), and then make some request (ie: save project, or similar), and you should see 2 requests get made, the first of which fails, and the second of which succeeds. The second call should also have a new/different bearer token in the headers.