How do I store auth token after user login in vue js?

Viewed 3203

I am using vue js as a front end and after authenticating user from my appi built with laravel I am receiving a token which is supposed to send with every consequent request for authenticating the api.

But how should I store the token in the browser Securely?

2 Answers

Your question is very broad. So I'm gonna give a general answer.

Use localStorageto store the token.

localStorage.setItem('name','tokenValue'); // to store the token
localStorage.getItem('name'); // to getthe token value

A simple web search will give you all you need to know about localStorage. Hope this helps.

Related