How to add values ββto localstorage in vue
I'm trying to have laravel passport authentication
, generating access tokens
and by storing them in localStorage
, I can get the access token, but by putting it in localStorage, I cannot retrieve the value, while doing this I am implementing something like this:
axios.post('/oauth/token', postData).then(response => {
if(response.status === 200)
{
authUser.access_token = response.data.access_token;
authUser.refresh_token = response.data.refresh_token;
console.log(authUser);
window.localStorage.setItem('authUser', JSON.stringify(authUser))
console.log(window.localStorage.getItem('authUser'))
}
})
As I said, I am implementing in a predefined laravel, so the resources I am using are the defaults. Do I need to add anything else? egvue-resource
+3
source to share