X
X
xcuube2019-09-01 21:59:55
JSON Web Token
xcuube, 2019-09-01 21:59:55

How to organize work with jwt in VUEX?

Hello, what is the best way to organize the work of a site with a restful api?
There is an api, when authorizing on the site, jwt is transmitted to the client and written to localstorage, after that this token is sent in each request to the api, and if it is valid, the server returns data, and if it is invalid / the action time has ended, the corresponding sign is returned to the client and the client deletes jwt from localstorage and is redirected to /login The
question is this. Is it normal that in each request it is checked whether the server sent a sign of invalidity / expiration of the token, or are there any more reasonable options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2019-09-01
@xcuube

This topic is easy to google and has already been described many times, for example https ://blog.sqreen.com/authentication-best-practi...
the token is not valid and you need to send the user for authorization

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question