[GH-ISSUE #276] prompt_for_user_token parses url incorrectly #153

Closed
opened 2026-02-27 23:21:06 +03:00 by kerem · 2 comments
Owner

Originally created by @CurtisHolick on GitHub (Apr 20, 2018).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/276

When I run this:
import spotipy.util as util

token = util.prompt_for_user_token('MU_USERNAME', scope='user-library-read', client_id='MY_CLIENT_ID', client_secret='MY_CLIENT_SECRET', redirect_uri='http://localhost/')

and insert the url from the browser into the prompt, it incorrectly parses it. The url only had the code value, and not whatever is supposed to come after the &. It worked after I added an & to the end of my url, and I am not sure if this is unique to me, but it seems like this is an error.

I found the url is parsed in oauth2.py line 188, and this is caused because it tries remove everything before the code, and everything after the & (including it), but there was no &.

Originally created by @CurtisHolick on GitHub (Apr 20, 2018). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/276 When I run this: `import spotipy.util as util` `token = util.prompt_for_user_token('MU_USERNAME', scope='user-library-read', client_id='MY_CLIENT_ID', client_secret='MY_CLIENT_SECRET', redirect_uri='http://localhost/')` and insert the url from the browser into the prompt, it incorrectly parses it. The url only had the code value, and not whatever is supposed to come after the `&`. It worked after I added an `&` to the end of my url, and I am not sure if this is unique to me, but it seems like this is an error. I found the url is parsed in `oauth2.py` line 188, and this is caused because it tries remove everything before the code, and everything after the `&` (including it), but there was no `&`.
kerem closed this issue 2026-02-27 23:21:06 +03:00
Author
Owner

@76MPaul commented on GitHub (May 25, 2018):

Idem for me, will try to find another way.

<!-- gh-comment-id:392196026 --> @76MPaul commented on GitHub (May 25, 2018): Idem for me, will try to find another way.
Author
Owner

@mattcole19 commented on GitHub (Jul 3, 2018):

Have the same issue

<!-- gh-comment-id:402232080 --> @mattcole19 commented on GitHub (Jul 3, 2018): Have the same issue
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#153
No description provided.