in authorization/client_credentials/app.js [13:26]
async function getToken() {
const response = await fetch('https://accounts.spotify.com/api/token', {
method: 'POST',
body: new URLSearchParams({
'grant_type': 'client_credentials',
}),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic ' + (Buffer.from(client_id + ':' + client_secret).toString('base64')),
},
});
return await response.json();
}