I created CLIENT_ID and Client_Secret and set my export parameters and also set a redirect_url like the howto says
export SPOTIPY_REDIRECT_URI='http://localhost'
The i run the script
import sys
import spotipy
import spotipy.util as util
scope = 'user-library-read'
if len(sys.argv) > 1:
username = sys.argv[1]
else:
print "Usage: %s username" % (sys.argv[0],)
sys.exit()
token = util.prompt_for_user_token(username, scope)
if token:
sp = spotipy.Spotify(auth=token)
results = sp.current_user_saved_tracks()
for item in results['items']:
track = item['track']
print track['name'] + ' - ' + track['artists'][0]['name']
else:
print "Can't get token for", username
I followed the link from the console on my pc: Opened https://accounts.spotify.com/authorize?scope .....
My Errors:
Illegal redirect_uri
or
INVALID_CLIENT: Invalid redirect URI
What did i wrong ??
Thx, Tatoosh
i forgot the last slash from the export url:
export SPOTIPY_REDIRECT_URI='http://localhost:8888/callback/'
After inserting token i got a new error:
Traceback (most recent call last):
File "o.py", line 13, in <module>
token = util.prompt_for_user_token(username, scope)
File "build/bdist.linux-armv7l/egg/spotipy/util.py", line 88, in prompt_for_user_token
File "build/bdist.linux-armv7l/egg/spotipy/oauth2.py", line 217, in get_access_token
spotipy.oauth2.SpotifyOauthError: Bad Request
Everything is working now through searching here. there was a typing bug in the docu.
thanks your thread helped me.
For all users new to this:
1) make this your redirect URI: SPOTIPY_REDIRECT_URI='http://localhost:8888/callback/'
2) and add it to your redirect uri whitelist in spotify > app > edit settings > white list
Everything is working now through searching here. there was a typing bug in the docu.
What is the typo? I'm facing the same issue..
Everything is working now through searching here. there was a typing bug in the docu.
What is the typo? I'm facing the same issue..
Same here. Can anyone help?
3 things to check for this problem https://github.com/plamere/spotipy/issues/402#issuecomment-573890067
Most helpful comment
thanks your thread helped me.
For all users new to this:
1) make this your redirect URI: SPOTIPY_REDIRECT_URI='http://localhost:8888/callback/'
2) and add it to your redirect uri whitelist in spotify > app > edit settings > white list