E
E
eugenedrvnk2020-10-20 17:10:00
JSON Web Token
eugenedrvnk, 2020-10-20 17:10:00

How to work with JWT correctly?

Usually, after the user has logged in, the received token is written to cookies / localstorage and on further requests the token is pulled from there, the duration of its action (expired) is checked and if everything is OK, then it is written to the request headers.
And how is the following scenario implemented, when there is some kind of conditional admin who can take and log out the user with his own command (early end the validity period of his jwt token). How to track this at the front, given that the token with a valid expiration time will still hang in the storage?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Borutkin, 2020-10-20
@Atanvar

websockets, the front subscribes and checks the event.
BU throws an event - log out, FU accepts a command, performs an action (am I the dude with that ID that came over), cleans the local store.
or on some action of the user BU just throws - 401

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question