fix(auth): refresh access token during navigation#101
Open
GresilleSiffle wants to merge 2 commits intonaturalsolutions:devfrom
Open
fix(auth): refresh access token during navigation#101GresilleSiffle wants to merge 2 commits intonaturalsolutions:devfrom
GresilleSiffle wants to merge 2 commits intonaturalsolutions:devfrom
Conversation
Author
|
Here is a draft of the step 2: GresilleSiffle#1 The refresh logic has been factorized to the component |
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.
Description
This branch is a first step to fix the access token refresh, currently not performed automatically by the front end. The proposed strategy is the following:
This branch implements the step 1.
Changes
The access token expiration date is now automatically checked during the user navigation, thanks to a new hook
useRefreshToken. If both the access token and refresh token are expired, the Keycloak logout is triggered.This will ensure that all HTTP GET requests performed during a page load are made with a valid access token.
Limitations
Note that
useRefreshTokenperforms an asynchronous request to refresh the access token. During this process it is possible that the displayed page starts to make HTTP requests with an expired access token. If such cases happen, we will be able to use thependingstate returned by the hookuseRefreshTokento delay the page rendering accordingly.Next steps
After this branch is merged, I'll implement the step 2.