[GH-ISSUE #247] Redirect URI Confusion #130

Closed
opened 2026-02-27 23:20:59 +03:00 by kerem · 0 comments
Owner

Originally created by @MoeMixMC on GitHub (Feb 1, 2018).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/247

I'm having issues with authentication (I know, pretty basic haha). But here's my code:
`import spotipy
import spotipy.util as util

sp = spotipy.Spotify()

scope = 'user-library-read'

util.prompt_for_user_token("my_username",scope,client_id='client_id',client_secret='client_secret',redirect_uri='python-spotify-test-app://callback')

results = sp.search(q='weezer', limit=20)
for i, t in enumerate(results['tracks']['items']):
print(' ', i, t['name'])`

As you can see I am passing in the parameters in the right order for the util#prompt_for_user_token method. However, I'm using a fake redirect URI (doesn't point to anything) and when I get prompted to enter the URL after running this code I get a Bad Request error. I'm making sure that what I input is EXACTLY the same as what I set the redirect url to be...

I know this question might be dumb but what should I put for the redirect uri? Thanks

EDIT: Fixed it... apparently, I forgot to add a slash at the end of my redirect uri.... lol

Originally created by @MoeMixMC on GitHub (Feb 1, 2018). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/247 I'm having issues with authentication (I know, pretty basic haha). But here's my code: `import spotipy import spotipy.util as util sp = spotipy.Spotify() scope = 'user-library-read' util.prompt_for_user_token("my_username",scope,client_id='client_id',client_secret='client_secret',redirect_uri='python-spotify-test-app://callback') results = sp.search(q='weezer', limit=20) for i, t in enumerate(results['tracks']['items']): print(' ', i, t['name'])` As you can see I am passing in the parameters in the right order for the util#prompt_for_user_token method. However, I'm using a fake redirect URI (doesn't point to anything) and when I get prompted to enter the URL after running this code I get a Bad Request error. I'm making sure that what I input is EXACTLY the same as what I set the redirect url to be... I know this question might be dumb but what should I put for the redirect uri? Thanks EDIT: Fixed it... apparently, I forgot to add a slash at the end of my redirect uri.... lol
kerem closed this issue 2026-02-27 23:20:59 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#130
No description provided.