Here is my code:
const axiosInstance = axios.create({
headers: {
Authorization: `Basic ${Buffer.from(`${client_id}:${client_secret}`).toString('base64')}`,
},
form: {
grant_type: 'client_credentials',
},
json: true,
});
const authFlow = async () => {
try {
const { response } = await axiosInstance.post('https://accounts.spotify.com/api/token');
return response;
} catch (error) {
console.log(error.message);
throw new Error(error);
}
};
This is almost copy and pasted off of the documentation: https://developer.spotify.com/documentation/general/guides/authorization/client-credentials/ I think there is something wrong with the formatting of the axios call, but not sure what. The error message just says "Request failed with status code 400". Any ideas on what I'm doing wrong?