JMPerez / spotify-web-api-js

A client-side JS wrapper for the Spotify Web API
https://jmperezperez.com/spotify-web-api-js/
MIT License
1.86k stars 260 forks source link

Length of playlist returned by getUserPlaylists() is 0. #198

Closed Kumar2106 closed 2 years ago

Kumar2106 commented 3 years ago

Describe the bug I am coding clone of spotify app. I am using this spotify-web-api-js. In my code where i am trying to fetch user playlist it is returning me items of length 0. i will be attaching the code and the screenshot of the inspector tool.

To Reproduce Steps to reproduce the behavior:

  1. const spotify = new SpotifyWebApi();
  2. spotify.setAccessToken(_token);
  3. spotify.getUserPlaylists().then((playlist) => { console.log("fetching playlist " + playlist); console.table("The playlist item is " + playlist.items); //dispatch function is basically context api used for state management. dispatch({ type: "SET_PLAYLIST", playlists: playlist, }); });
  4. Screenshot from 2021-05-13 13-06-32

Expected behavior getUserPlaylists() function should return playlist of a user.

Screenshots Screenshot from 2021-05-13 13-06-29

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

andrei-su commented 3 years ago

Any updates for this issue ?

JMPerez commented 2 years ago

@AndreiMihaiSurueanu did you end up finding the issue? this can be either that you haven't requested the right scope, or that the user doesn't have any public playlists. In any case, it's not an issue of this library itself, so I'll close this issue for now.