atinux / nuxt-auth-utils

Add Authentication to Nuxt applications with secured & sealed cookies sessions.
MIT License
976 stars 91 forks source link

fix: avoid duplicate trigger of session fetch hook due to request retry #83

Closed Diizzayy closed 7 months ago

Diizzayy commented 7 months ago

The nitro session fetch hook is likely to be used for implementing the necessary checks to ensure token validity, this might require making additional network requests to the pertinent authentication server.

The current implementation results in the aforementioned checks being made twice whenever the session cookie is present, and the earlier checks have failed (returned throw createError() within session fetch hook), hence resulting in unnecessary overhead.

atinux commented 7 months ago

Nice one @Diizzayy ❤️