Announcements

Help Wizard

Step 1

NEXT STEP

Not able to retrieve currently playing track.

Not able to retrieve currently playing track.

Plan

Premium

Country

US

My Question or Issue

I'm trying to write a Python application to get my currently playing track (and it's album art). The problem is that I keep getting "Oops! Something went wrong" as an error. My client ID and Secret are correct, I've registered my URI as a port on localhost, is there anything I'm missing? I've removed the id and secret, so imagine that its the correct string of letters and numbers please.

 

import spotipy
from spotipy.oauth2 import SpotifyOAuth

client_id = 'id'
client_secret = 'secret'
redirect_uri = 'localhost:52182/callback'
scope = 'user-read-currently-playing'

state = ""
cache_path = ".cache"

auth_manager = SpotifyOAuth(scope=scope,
client_id=client_id,
client_secret=client_secret,
redirect_uri=redirect_uri,
state=state,
cache_path=cache_path)


sp = spotipy.Spotify(auth_manager=auth_manager)

current_track = sp.current_playback()
print(current_track)

 

I got a pop-up requesting authorization from spotify to access my account, and once I hit accept, it started giving me the error. I've de and re-authorized the application and yet it doesn't work.

 

Reply
3 Replies

You can try to add http:// in front of the redirect uri (in your code and in the dashboard of your app).

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Now I'm just getting a blank screen, not even an error message.

 

I think I'm getting some server side Authentication error as I haven't seen anything that's breaking my code.

After I changed the scope to 'user-read-currently-playing user-read-playback-state' (by adding the second scope), it worked for me.

That you also need this scope, is only documented here: https://developer.spotify.com/documentation/web-api/concepts/scopes#user-read-playback-state

 

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Suggested posts

Let's introduce ourselves!

Hey there you, ย  Yeah, you!ย 😁 ย  Welcome - we're glad you joined the Spotify Community! ย  While you here, let's have a fun game and getโ€ฆ

ModeratorStaff / Moderator/ 4 years ago  in Social & Random