2

I am trying to access tracks from a playlist with xinranxiao:spotify-web-api for MeteorJS. I sign in with a spotify account and am able to access data from spotify api. I am able to obtain users playlists, tracks, and artists etc. However If I try to play a song with a direct href url I get a ``

{
  "error": {
    "status": 401,
    "message": "This request requires authentication."
  }
}

I have configured my Spotify in a server located js file: `` ServiceConfiguration.configurations.update

(
  { "service": "spotify" },
  {
    $set: {
      "clientId": "eeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "secret": "bbbbbbbbbbbbbbbbbbbbbbb"
    }
  },
  { upsert: true }
);

In my client side js files I access playlists successfully running.

getUserPlaylists: function() {
// Get a user's playlists

let spotifyApi = new SpotifyWebApi()

let userplaylists = spotifyApi.getUserPlaylists(Meteor.user().profile.id,function(err,data){
  if(err){
    console.log("Retrieval error ", err)
  }
  else{
    console.log("Success, your playlist ", data.body)
  }
})
return userplaylists
}//end getUserPlaylists

So although I can see and access the data, I am unable to point to the track href url without getting a 401 error?

Felice
  • 571
  • 1
  • 7
  • 22

0 Answers0