nuxt-auth-sanctum
nuxt-auth-sanctum copied to clipboard
[Question] User inactivity go back and session is lost but still in some auth page
I was looking to see if there is already an issue registered on this topic but I didn't find one.
The issue is whether the module somehow realizes that the user no longer has a session with the backend, the user can leave the tab inactive for more than an hour and when he comes back while there are no requests to the backend he can be filling out a form and no longer have a session and until he hits send is when the system realizes it but for this the user has already wasted time filling out the form.
Is there something in the module to redirect when losing the session?
Hey @chapus, thanks for bringing this up! Indeed we didn't discuss this kind of behavior, but to be honest, I don't think it is in the scope of the module itself.
I would suggest defining application-specific functionality that can take care of periodic requests. For example call refreshIdentity from useSanctumAuth every N minute, or check the cookie lifetime (but we cannot trust it since backend can invalidate it anytime).
Feel free to share your thoughts on it!
Closing this one due to inactivity, feel free to re-open in case of questions