I know this has been posted before but I am unable to get their solutions to work.
Every time I authorise my Spotify account after running my code, it asks me to paste my redirect URI into the terminal, but every time I do that, it throws an error. I am using Python 3.9 and Tekore version 4.5.0.
I have whitelisted the site on the Spotify developer dashboard (I tried Youtube because the default 'example.com/callback' threw a similar error). I tried a few different sites, each throwing up a slightly different error message, but ultimately from the same source something is wrong with the site.
What I expect to happen is that once I authorise my Spotify account, it takes me to the redirect site and then saves authorisation information locally, but it doesn't save the information locally and throws an error, like shown above. Finally, here is the code.
import tekore as tk
client_id = '' #ids are missing intentionally
client_secret = ''
token = tk.request_client_token(client_id, client_secret)
# Call the API
spotify = tk.Spotify(token)
# Use the response
for track in album.tracks.items:
print(track.track_number, track.name)
redirect_uri = 'https://youtube.com'
user_token = tk.prompt_for_user_token(client_id, client_secret, redirect_uri, scope=tk.scope.every)
conf = tk.config_from_file('tekore.cfg', return_refresh=True)
user_token = tk.refresh_user_token(*conf[:2], conf[3])
conf = (client_id, client_secret, redirect_uri, user_token.refresh_token)
tk.config_to_file('tekore.cfg', conf)
spotify.playback_start_tracks('2Gt7fjNlx901pPRkvBiNBZ?si=9a9b8c9ca1634041')