thelinmichael / spotify-web-api-node

A Node.js wrapper for Spotify's Web API.
http://thelinmichael.github.io/spotify-web-api-node/
MIT License
3.1k stars 497 forks source link

spotifyApi.addTracksToPlaylist 403 issue #167

Open YunyuZhang opened 6 years ago

YunyuZhang commented 6 years ago

When I call spotifyApi.addTracksToPlaylist("78q0ixigszbxoodohszxk5c99","6KU9Lo2ZyB7AbXCK7qt8rk",["spotify:track:6rPO02ozF3bM7NnOV4h6s2"])

I got Something went wrong! { [WebapiError: Forbidden] name: 'WebapiError', message: 'Forbidden', statusCode: 403 }

"78q0ixigszbxoodohszxk5c99" is my user id and "6KU9Lo2ZyB7AbXCK7qt8rk" is my playlist id. Could someone please help me?

ablamunits commented 6 years ago

+1 I am also encountering the same problem. Any suggestions?

onhernandes commented 6 years ago

Did you check your access token' scopes? Maybe there's something missing. Mine are ["playlist-read-private", "playlist-modify-private", "playlist-modify-public"]

ablamunits commented 6 years ago

@onhernandes it ended up being the token scope for me. Thanks!

brodin commented 6 years ago

Did this solve your problem @YunyuZhang ?

gwynnebaer commented 6 years ago

I have a similar problem with scopes. @onhernandes how did you set the scopes properly?

jmelendev commented 6 years ago

Anyone find a solution for this yet? Running into the same issue.

onhernandes commented 6 years ago

My problem was related to the scopes. I used these ones, and they worked for me: ["playlist-read-private", "playlist-modify-private", "playlist-modify-public"]

MrAmericanMike commented 5 years ago

Maybe this was related to an old version of the API, but on the request you don't need a username or user ID, just a playlist and a list of song/songs to add.

gbordoni commented 5 years ago

@onhernandes How do you set the scopes in the code?

jmelendev commented 5 years ago

@onhernandes How do you set the scopes in the code?

It get's passed into the createAuthorizeUrl method as an argument. Take a look here https://github.com/thelinmichael/spotify-web-api-node#authorization-code-flow.

Here is a list of the available scopes: https://developer.spotify.com/documentation/general/guides/scopes/#scopes