feat: forward set-cookie header for useUserSession().clear()
#282
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.
This is initial work to have a better way to deal with refresh tokens (#91)
IMO, the refresh tokens should be implemented using an app middleware that run during SSR or client-side navigation (skipping it during hydration).
I added an example in the playground to move forward and simplify as much as possible the refresh middleware.
This pull request starts simple by adding the ability to forward the cookie back to the main SSR request when calling the
clear()
method, useful if both access token and refresh tokens are expired.I also added an example for the refresh middleware.
Later on, I plan to work on a
$authFetch
(or $api) to make sure the requests done are up to date in term of cookie headers as well as adding listener to automatically refresh the user/session fromuseUserSession()