auth-module: LaravelJWT error with ExpiredAuthSessionError: Both token and refresh token have expired. Your request was aborted.
“@nuxtjs/auth-next”: “5.0.0-1608280312.c5867c3” “nuxt”: “^2.14.12”,
auth: {
strategies: {
laravelJWT: {
provider: 'laravel/jwt',
url: '/api/auth',
endpoints: {
login: { url: '/api/auth/login', method: 'post' },
refresh: { url: '/api/auth/refresh', method: 'post' },
user: { url: '/api/auth/user', method: 'get' },
logout: { url: '/api/auth/logout', method: 'post' },
},
token: {
property: 'token',
maxAge: 60 * 60,
},
refreshToken: {
property: 'token',
maxAge: 20160 * 60,
},
user: {
property: 'user',
},
},
},
},
axios: {
proxy: true,
credentials: true,
},
proxy: {
'/api': {
target: process.env.API_URL || process.env.APP_URL,
},
},
router: {
middleware: ['auth'],
},
-
When logged in, then do “logout”, and refresh page got:
ExpiredAuthSessionError: Both token and refresh token have expired. Your request was aborted. at eval (webpack-internal:///./node_modules/@nuxtjs/auth-next/dist/runtime.mjs:798:17)
-
clean all cookie from chrome, refresh page got same problem
ExpiredAuthSessionError: Both token and refresh token have expired. Your request was aborted. at eval (webpack-internal:///./node_modules/@nuxtjs/auth-next/dist/runtime.mjs:798:17)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 32
@pi0 Please check again, this problem is still exists in the latest version.
Still facing this issue
Hi guys! Thank you for report. We’ll take a look at this issue 😃
I can reproduce this in @nuxtjs/auth-next@5.0.0-1613647907.37b1156 by setting extremely short token expiration dates in the backend (in my case Python rest_framework_simplejwt), e.g. 5s/10s token/refresh token and then doing this:
This results in
The auth module will correctly log out the user and redirect to the login page, but the error nevertheless lands in the console and triggers Sentry logs etc.
Can somebody reopen it?
Same bug, downgrade to
"@nuxtjs/auth-next": "5.0.0-1607693598.34d83ea"fix my problemLooks like dev team dont need to check token and token validity for each request because i actually have many requests which is not requires any tokens
For those still having this issue, in my specific case the problem was that i had some outdated methods that were handling the access token manually like:
and now all of that logic should be handled via Auth module like:
after changing those, the error went away. Hope it helps someone.
I encountered this problem and it turned out that when I was using jsonwebtoken to generate my token at the back end, for the
expiresInarg I was passing a string instead of a number (I got it from process.env). If you do this, it assumes you are specifying the number of milliseconds before expiry rather than the number of seconds.Restarting PC worked for me 😂 I tried it on staging URL and it was working just fine, then another colleague tried running it locally and it worked for him as well. So it must have been my local problem. After restarting my PC everything started to work properly.
I m’ able to reproduce this problem, by opening 2 tabs, and logout in 1 tab (which revoke access & refresh tokens). The other tab throw an ExpiredAuthSessionError when trying to navigate.
Maybe this.$auth.reset(); or this.scheme.reset(); should be added before throwing ExpiredAuthSessionError like is it done when refresh token is not ‘refreshable’.
@JoaoPedroAS51 your last commit has broke
USERrequest. After successful login it doesn’t sendAuthorizationheader and cookies.Currently having the same issue with local auth. It worked before the latest version and now it always says
ExpiredAuthSessionError: Both token and refresh token have expired. Your request was aborted. at eval (webpack-internal:///./node_modules/@nuxtjs/auth-next/dist/runtime.mjs:798:17)