[GH-ISSUE #359] Hello everyone, beginner here! util.prompt_for_user_token #208

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

Originally created by @JeanPaiva42 on GitHub (Feb 28, 2019).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/359

Is there a way I can get the redirected link automatically? Also, how can I get the user id when running? Sorry if this is a repost. Thanks for any replies.

Originally created by @JeanPaiva42 on GitHub (Feb 28, 2019). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/359 Is there a way I can get the redirected link automatically? Also, how can I get the user id when running? Sorry if this is a repost. Thanks for any replies.
kerem closed this issue 2026-02-27 23:21:24 +03:00
Author
Owner

@CraigMcAulay1101 commented on GitHub (Apr 22, 2019):

There isn't any way to get the redirect link automatically, as the user has to authorize the app's scopes. Although through using flask, I've managed to automate this slightly by using flask's request object to get the current URL (once the redirect has taken place) and then using the oauth2 object from spotipy to recreate the other steps in util.prompt_for_user_token()

 code = sp_oauth.parse_response_code(request.url)
 token_info = sp_oauth.get_access_token(code)
 token = token_info['access_token']

Hope this helps.

<!-- gh-comment-id:485453119 --> @CraigMcAulay1101 commented on GitHub (Apr 22, 2019): There isn't any way to get the redirect link automatically, as the user has to authorize the app's scopes. Although through using flask, I've managed to automate this slightly by using flask's request object to get the current URL (once the redirect has taken place) and then using the oauth2 object from spotipy to recreate the other steps in util.prompt_for_user_token() ``` code = sp_oauth.parse_response_code(request.url) token_info = sp_oauth.get_access_token(code) token = token_info['access_token'] ``` Hope this helps.
Author
Owner

@JeanPaiva42 commented on GitHub (Apr 30, 2019):

I'm going to try this, thanks!

<!-- gh-comment-id:488098393 --> @JeanPaiva42 commented on GitHub (Apr 30, 2019): I'm going to try this, thanks!
Author
Owner

@stephanebruckert commented on GitHub (Jan 1, 2020):

Is there a way I can get the redirected link automatically?

@Craig115's answer seems right!

Also, how can I get the user id when running?

From the official app, go to your profile and do "Copy profile link". Your user ID is part of the link.

Hope this helps. Closing for now but feel free to reopen if needed.

<!-- gh-comment-id:570085452 --> @stephanebruckert commented on GitHub (Jan 1, 2020): > Is there a way I can get the redirected link automatically? @Craig115's answer seems right! > Also, how can I get the user id when running? From the official app, go to your profile and do "Copy profile link". Your user ID is part of the link. Hope this helps. Closing for now but feel free to reopen if needed.
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#208
No description provided.