import axios from 'axios'; class AccessToken { credentials = 'NXR5N2d4bUFmUWxVSERIZG03a2dhcVh3SzVJYTp3cElPVVJuSkpjVHRPNnJPUlltWVlQcTR3WGth' device = '123' constructor() { const headers = { 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Basic ' + this.credentials }; axios.post('https://api.vasttrafik.se/token','grant_type=client_credentials&scope=device_'+this.device, {headers} ) .then(response => { console.log(response); this.token = response.data.access_token }); } } export default AccessToken