mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #451] util.prompt_for_user_token only returns token for on user #267
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#267
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 @coffeemakingtoaster on GitHub (Mar 11, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/451
When calling util.prompt_for_user_token(username) I always get the authentication token for one user (no matter what username I pass to the function). I saw that clearing the cache was marked as "enhancement" but I was wondering if there are any workarounds for now.
Thanks in advance :D
@stephanebruckert commented on GitHub (Mar 11, 2020):
It might find and use your existing token. To sign in using another user, can you try
@coffeemakingtoaster commented on GitHub (Mar 11, 2020):
Still returns token for a different user. Printing me() returns a different account than the one passed to prompt_for_user_token().
I am unsure if show_dialog=True should enable terminal output, because it doesn´t.
My code:
`import os
import spotipy.util as util
import spotipy
os.environ["SPOTIPY_CLIENT_ID"] = my client id
os.environ["SPOTIPY_CLIENT_SECRET"] = my secret
os.environ["SPOTIPY_REDIRECT_URI"] = "https://google.com"
username = a username
scope = "user-read-private user-read-email user-read-playback-state user-modify-playback-state"
my_token = util.prompt_for_user_token(username,scope=scope,show_dialog=True)
print(spotipy.Spotify(auth=my_token).me())`
@coffeemakingtoaster commented on GitHub (Mar 11, 2020):
Found the solution. Logging out of any spotify account in my browser solved the issue as it seems a token for the currently logged in account was prompted.
Thank you for your help and quick response!