0

I have been trying to play a spotify playlist using spotipy using the authorization code flow and I keep getting that error :

HTTP Error for PUT to https://api.spotify.com/v1/me/player/play returned 403 due to Player command failed: Premium required

I checked and I am a prenium user. I managed to have access to the playlist as I can print them, but I can not modify or play one of the playlist.

RKMake
  • 37
  • 7
  • First question: indeed you get "Premium required" because you need the authorization code flow – Stéphane Bruckert Jun 05 '20 at 10:24
  • Second question: `I can not modify or play one of the playlist.` you need to tell us more about that. Please update your question to only reflect your second problem, because it seems you've already solved the first one – Stéphane Bruckert Jun 05 '20 at 10:25
  • Mybad, I didn't explain correctly. There are two ways to connect to a user account using the Authorization Code Flow and using the Client Credentials Flow. I've used both method but it only allowed me to get metadata. Whenever I try to create or modify a playlist or use the playback I get that error saying I need prenium privilege, even though I am already prenium. I don't know if it is because it is a family prenium account instead of a regular one ? – RKMake Jun 06 '20 at 11:33
  • ok, in my experience this message is usually correct: either this is not the correct account (double check with `sp.me()`) or the Authorization Code Flow isn't working properly and the token you use doesn't belong to any user. Can you please share a minimal working example (auth included)? – Stéphane Bruckert Jun 07 '20 at 01:09
  • `import spotipy from spotipy.oauth2 import SpotifyClientCredentials import json client_credentials_manager = SpotifyClientCredentials(client_id=my_client_id,client_secret=my_secret_id) sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager) playlists = sp.user_playlists('spotify') sp.me()` and I got this error this time `HTTP Error for GET to https://api.spotify.com/v1/me/ returned 401 due to Unauthorized.` – RKMake Jun 09 '20 at 10:14
  • You are not using the authorization code flow but the client credentials flow. For user endpoints, don't use `SpotifyClientCredentials`, use `SpotifyOAuth`. Have another look at the example given in the README https://github.com/plamere/spotipy#with-user-authentication – Stéphane Bruckert Jun 14 '20 at 22:53

0 Answers0