A
A
Analka2021-11-29 21:47:37
Vue.js
Analka, 2021-11-29 21:47:37

Authorization in Vue 3 composition?

Hello!

For the first time trying to develop authorization in Vue + compostion-api.

Tell me:
1) how to automatically catch via axios whether there is a token in localStorage JWT
2) How to automatically check if the token has expired, then make a refreshToken or redirect to the login page
3) How to receive user data automatically if, for example, you pressed f5 in the browser ( I think to store the token in localStorage, and the user data in the Store - I work with Pinia)

I would be grateful if you could help me figure it all out

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
low molecular macro, 2021-11-29
@molekulyarniy

1) on the server, check if the token came in cookies
2) on the server, do verify

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question