mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #405] util.prompt_for_user_token stops opening correct browser page to actually log in to Spotify for authorization #238
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#238
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 @grantbrewster on GitHub (Dec 17, 2019).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/405
Hi everyone! Looking forward to the updates to this awesome project and hoping to help out. I just started working with this API this weekend, and I made a simple console application that scrapes setlist URLs in order to automatically create playlists for people based on setlist.fm urls. Repo : https://github.com/grantbrewster/SpotifySetlistCreator . However for my auth, after the first time i run the program, it never again correctly opens a browser window to let me log in to spotify, so it limits the app to only work for my account. I tried deleting the cache in the directory as well as clearing my chrome cache and then running it but that does not solve the problem. SO i feel the issue may be in the prompt_for_user_token method. I found this stackoverflow that mentions that webbrowser.open() may be at fault : https://stackoverflow.com/questions/38574629/webbrowser-not-opening-new-windows
here is the code from util
and this is how I get the token:
I am new to Spotipy so maybe i am doing something incorrectly but according to the documentation this seems to be the correct way of doing it ! Any help would be appreciated
@felix-hilden commented on GitHub (Dec 18, 2019):
Does it work if you print the link and manually navigate to the page? Then it might be
webbrowserat fault, in which case you could construct another version of the function yourself. However, if you are talking about an automatic login, that's Spotify remembering that you already gave permission to the app. Changing scope might require another login. But in that case, printing the link and opening it in a private window might do the trick!@grantbrewster commented on GitHub (Dec 19, 2019):
It seems like the prompt correctly opening a Spotify auth is pretty buggy, but honestly might be on the chrome side of things opposed to the the Spotipy side. Sometimes it works, and other times it does not even if both the local/chrome cache are deleted. The only thing that spotipy caches in this function is the user token correct? Thanks for the quick reply!
@felix-hilden commented on GitHub (Dec 19, 2019):
For me, when I use an equivalent routine (without token caching, mind you), the redirects are automatic yielding the final redirect url with code immediately. But it works as expected consistently. I think it is a Spotify login session thing before anything else. Can't really speak for you if you think there is something else happening. I'm on Windows 10 and Firefox.
Yes, only the token is cached.
@stephanebruckert commented on GitHub (Jan 17, 2020):
Your browser is still connected to your spotify account, just go to https://www.spotify.com/ and log out