S
S
seredaes2021-06-18 16:32:44
JSON Web Token
seredaes, 2021-06-18 16:32:44

How to solve VueJS JWT logout issue with multiple browser tabs?

Good day.

Faced such a problem.

Two tabs open (at the same time),
see that the access_token is outdated, send a request
for a refresh_token.

The first tab - the answer comes, the
second comes 404, because. the data has already
been changed by the first tab
and eventually logs out all tabs.

The status is stored in Cookies, like someone has already sent
for an update, you should not rock the boat, wait for an answer ...
But due to the fact that this happens at the same time, the
second tab does not have time to read cookies ...

I set a delay to check the status 1 second,
3-4 tabs worked fine...
A little more tabs - there is not enough time and at least two requests manage to
slip through ...

Maybe there are some practices for solving this problem?
Or a useful article ... because. I found a lot of advice in Google, but
how to deal with multiple tabs ...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question