JMPerez / spotify-web-api-js

A client-side JS wrapper for the Spotify Web API

Home Page:https://jmperezperez.com/spotify-web-api-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Length of playlist returned by getUserPlaylists() is 0.

Kumar2106 opened this issue · comments

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,
    });
    });

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):

  • Ubuntu 20.04
  • Firefox
  • 88.0.1

Additional context
Add any other context about the problem here.

Any updates for this issue ?

@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.