Search code examples
pythonspotifyspotipy

Python Spotipy missing permission for headers


I'm trying to use Spotipy, one of spotify API, in Python, you can find this here

Everything was working (I haven't done much except for all the beginning part) until I tried to play some music with the start_playback() function.

In the documention, it was said that the scope have to be user-read-playback-state, which is, but even with this scope, this is not working.

Here is what I wrote :

scope = 'user-read-playback-state'


token = util.prompt_for_user_token(username,
                           scope,
                           client_id=clientID,
                           client_secret=clientsecret,
                           redirect_uri="http://google.com/")


# création of spotify object
spotifyObject = spotipy.Spotify(auth=token)

# the url of one of my playlist 
iden = "6a0PMD9AsNoK3XD5Nnheig"

# here, I want to play a music of the paylist i've just chosen 
spotifyObject.start_playback(context_uri = iden)
# and the problem is here

the problem is : https://api.spotify.com/v1/me/player/play: Permissions missing

and I don't understand why, and i'm pretty new so maybe it's a newbie mistake or something else Thanks for your future help :)


Solution

  • I found how to 'repair' it ! the scope have to be : 'streaming' and the url of the playlist have to be the complete one, so spotify:playlist:6a0PMD9AsNoK3XD5Nnheig instead of 6a0PMD9AsNoK3XD5Nnheig

    i'll be happy if it helps someone too :)