spotify-web-api-ts icon indicating copy to clipboard operation
spotify-web-api-ts copied to clipboard

player.getCurrentlyPlayingTrack triggers a 400 response

Open miguel-martinr opened this issue 4 years ago • 0 comments

I think the parameter market for player.getCurrentlyPlayingTrack should be required.

I've been the whole day dealing with a code 400 (bad request) response after using player.getCurrentlyPlayingTrack, I think the problem is that for the endpoint used (https://api.spotify.com/v1/me/player/currently-playing) the query parameter market is required while player.getCurrentlyPlayingTrack takes it as an optional parameter.

After setting the market it started to work just fine:

const webApi = new SpotifyWebApi({clientId, clientSecret, redirectUri, accessToken});
const currentlyPlaying = await webApi.player.getCurrentlyPlayingTrack({
        market: 'ES',
});

I apologize if there is something I am overlooking 😅

miguel-martinr avatar Sep 08 '21 01:09 miguel-martinr