websanova / vue-auth

A simple light-weight authentication library for Vue.js
MIT License
2.36k stars 380 forks source link

bug multiple refresh #635

Open nunob87 opened 3 years ago

nunob87 commented 3 years ago

if you do several refreshes in a row, it will give an error in the session, and kill the session

createError.js:16 Uncaught (in promise) Error: Request failed with status code 401 at e.exports (createError.js:16) at e.exports (settle.js:17) at XMLHttpRequest.d.onreadystatechange (xhr.js:69)

websanova commented 3 years ago

Seems like the error is coming fr that api?

nunob87 commented 3 years ago
"@websanova/vue-auth": "^4.1.1",
"vue": "^2.6.12",
lucianobosco commented 3 years ago

Hey @nunob87 , why are you using sessions? The token-based auth supposed to be stateless, therefore no sessions should be used at all. You only need to keep record on the server-side about valid tokens and compare them with the token sent by Axios headers.

kami4ka commented 3 years ago

Using vue-auth 3.3.8 and the same happens for me. When refresh returns 401 it throws an unhandled exception (it happens when refreshing with old/invalid token, probably page stops refreshing when not active or something like that).