mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #495] How to terminate token process if user exits authentication page? #295
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#295
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @StephenChou on GitHub (May 20, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/495
So in my web app I'm trying to account for the possibility that a user exits the Spotify authentication page without authenticating. How do I terminate the process? I have an "if token ... else return false" statement for the token but it doesn't seem to get there, it just stays running.
@ysinjab commented on GitHub (May 27, 2020):
Assuming you are using authorization code: the user is unauthorized until he login & and give your application the authorization to access the scopes. https://tools.ietf.org/html/rfc6749#section-1.3.1
@stephanebruckert commented on GitHub (May 30, 2020):
@stephenchou indeed the default is that if you do the following it will prompt and block if the spotipy authentication window is closed:
To prevent prompting what you want to do is call
auth_manager.get_access_token(code)before callingspotify.me(). A good example that does this is the API example https://github.com/plamere/spotipy/blob/master/examples/app.py where each action is separate and therefore won't block the main process@StephenChou commented on GitHub (May 30, 2020):
@stephanebruckert Thanks for your response. I forgot to mention that I'm using the "prompt_for_user_token" function and it doesn't seem to be returning false when I exit the authorization webpage without authenticating. Should I avoid using that then?
@stephanebruckert commented on GitHub (May 31, 2020):
@StephenChou do you mean that it behaves as expected with
auth_managerbut doesn't withprompt_for_user_token?@StephenChou commented on GitHub (May 31, 2020):
@stephanebruckert Haven't tried auth manager yet, was hoping that I could possibly still use prompt_for_user_token, which doesn't seem to be hitting my false condition when I exit the authentication page. I guess I should probably try auth_manager then.
@stephanebruckert commented on GitHub (May 31, 2020):
Yeah I doubt it will be any different with the auth_manager. If the authentication page is closed, I can't see how the python app could know about it because nothing is sent to the redirect URI. If this is a problem for you I really suggest you do something similar to the API example
@stephanebruckert commented on GitHub (Jun 14, 2020):
Your solution is here, closing