Skip to content

Conversation

@atinux
Copy link
Owner

@atinux atinux commented Nov 14, 2024

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 from useUserSession()

@atinux atinux added the enhancement New feature or request label Nov 14, 2024
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 14, 2024

Open in Stackblitz

pnpm add https://pkg.pr.new/atinux/nuxt-auth-utils@282

commit: 4822dde

@atinux atinux merged commit f147d1a into main Nov 14, 2024
4 checks passed
@atinux atinux deleted the feat/refresh branch November 14, 2024 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants