1

I have a problem with this code:

scope = 'user-read-currently-playing'
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id='', client_secret='', scope=scope, redirect_uri=''))

result = sp.current_playback()
print(result)

I'm trying to get the song to listen, but I get this error:

requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.spotify.com/v1/me/player

if i click to 'https://api.spotify.com/v1/me/player' the result is:

{
 "error": {
  "status": 401,
   "message": "No token provided"
  }
}

I can't understand what the mistake is.

Thanks for who will help me

  • Welcome to SO! Are your SpotifyOAuth data really just empty strings or did you actually fill them with your API token details? – leun4m May 18 '21 at 16:29
  • Thank you! no I filled them with my credentials, taken from 'My dashboard', actually I did not specify this in the post – Marco Zolli May 18 '21 at 16:33
  • Is this answering your problem: https://stackoverflow.com/questions/54436348/spotipy-client-credential-manager-no-token-provided – AleksanderGD May 18 '21 at 16:36
  • I'm sorry but I don't see the difference, I use 'SpotifyOAuth' as in the documentation, if I use 'SpotifyClientCredentials' I cannot pass it the 'request_uri' – Marco Zolli May 18 '21 at 16:47

1 Answers1

0

I think the correct scope for the /player endpoint is user-read-playback-state

rob_med
  • 496
  • 3
  • 7
  • Hello ! yes i had solved in the end, the scope was wrong but i also had another type of account level problem, thanks so much for the help! – Marco Zolli May 21 '21 at 15:16