'Spotify/axios question for my first solo project (noob question)

This is probably a silly question - I only started learning code in September and this is my first solo project in React (or at all really).

I hit a wall on my first build trying to make a POST request to the Spotify API to get back an access token:

https://developer.spotify.com/documentation/general/guides/authorization/client-credentials/

I keep getting error 415 with this request and I am using the 'Content-Type' : 'application/x-www-form-urlencoded' as they reccomended in the Spotify API docs.

Any help would be so appreciated!

export const SpotifyAPI = () => {

const buffer = new Buffer.from(`${client_id}:${client_secret}`);

  axios.post(
    'https://accounts.spotify.com/api/token', {
        form: { grant_type: 'client_credentials' },
        headers: {
            Authorization: 'Basic' + buffer.toString('base64'),
            'Content-Type': 'application/x-www-form-urlencoded',
        },
    }).then(response => console.log(response));


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source