Environment
- Operating System: Darwin
- Node Version: v20.18.1
- Nuxt Version: 3.15.4
- CLI Version: 3.21.1
- Nitro Version: 2.10.4
- Package Manager: yarn@1.22.22
- Builder: -
- User Config: compatibilityDate, devtools, css, app, modules, postcss, vite, runtimeConfig, auth
- Runtime Modules: @pinia/nuxt@0.9.0, @nuxt/eslint@1.0.0-rc.1, @sidebase/nuxt-auth@0.10.0
- Build Modules: -
Reproduction
Mock the response of the user endpoint so that it doesn't get a 200 response; anything other than a 401 error would be fine.
Describe the bug
When the API call for the user endpoint gets an error, the user gets logged out. This is an unwanted behavior for our use case. We only want to log out the user when an API call gets a 401 error. Other cases could be temporary network or server issues and logging out the user is an extreme reaction because the issue is very likely to be resolved with a refresh (assuming the JWT token is still valid).
Additional context
@nuxtjs/auth-next module had a config called resetOnError which could be set to false and we could override the error behavior by setting $auth.onError handler. I couldn't find a similar config in this module.
Logs
This is an example error log of the scenario I described.
Our website could only be accessed via a VPN and if you open the website without that VPN, you get logged out.
This would be annoying for the users.
ERROR Session: unable to extract session, [GET] "https://some.domain.com/api/user/": 403 Forbidden
Environment
Reproduction
Mock the response of the user endpoint so that it doesn't get a 200 response; anything other than a 401 error would be fine.
Describe the bug
When the API call for the user endpoint gets an error, the user gets logged out. This is an unwanted behavior for our use case. We only want to log out the user when an API call gets a 401 error. Other cases could be temporary network or server issues and logging out the user is an extreme reaction because the issue is very likely to be resolved with a refresh (assuming the JWT token is still valid).
Additional context
@nuxtjs/auth-next module had a config called
resetOnErrorwhich could be set tofalseand we could override the error behavior by setting$auth.onErrorhandler. I couldn't find a similar config in this module.Logs