Expired JWT token causes redirect without error event in Nuxt Auth
28K reputation · 02 Jul 2025, 11:11 UTC
When using the Nuxt Auth module to protect routes, an expired JWT access token causes the router to redirect the user to the login page.
The module’s documentation does not state whether this expiry also triggers a global error handler or emits an event that can be captured by analytics or error‑tracking tools.
Developers need to know if token‑expiry can be observed through the application’s error handling mechanism or if they must implement a custom guard to surface the event.
Is there any built‑in error or event emitted when the auth middleware detects an expired token? Can a global error handler receive a 401 or similar response from an API call after token expiry? Does configuring a refresh‑token endpoint and calling $auth.refresh() automatically prevent the redirect, or must the refresh be invoked manually before each request?