Best practice for storing auth tokens in VueJS? : <p>My backend is a REST API served up by Django-Rest-Framework. I am using VueJS for the front end and trying to figure out what is the best practice for doing authentication/login. This is probably terrible code, but it works (in a component called <code>Login.vue</code>):</p>

<pre><code>    methods: {
        login () {
            axios.post('/api-token-auth/login/', {
                username: this.username,
                password: this.pwd1
            }).then(response =&gt; {
                localStorage.setItem('token', response.data.token)
            }).catch(error =&gt; {
                console.log("Error login")
                console.log(error)
            })
            this.dialog = false
        }
    }
</code></pre>

<p>Does it make sense to use <code>localStorage</code> this way? Also, I'm wondering when the user wants to sign out, and I call <code>/api-token-auth/logout</code>, do I still need to remove the token from <code>localStorage</code>? It's not actually clear to me what goes on with the tokens either on Django's end or the browser/Vue.</p>
