<template> <div> <span>{{msg}}</span> <span>{{token}}</span> </div> </template> <script> import axios from 'axios' export default { name: 'HelloWorld', data () { return { msg: 'Welcome to Your Vue.js App', token: '' } }, created: function () { axios.post('http://localhost:8000/api-token-auth/', { username: 'robin', password: 'p' }).then(token => { this.token = token.data.token }) } } </script>