mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 16:45:52 +03:00
[GH-ISSUE #677] Spotify occasionally forces me to change my password, which affects all stored spotify tokens. Resetting password and creating new tokens, scripts don't work anymore #401
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#401
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 @shillshocked on GitHub (Apr 20, 2021).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/677
Describe the bug
My Spotify password occasionally doesn't work anymore, which requires a password reset. Doing so invalidates all my old app tokens. I can regenerate those ones (I keep them as local files cached to refresh), but now they aren't working, even with no error message.
@shillshocked commented on GitHub (Apr 20, 2021):
I'm guessing it might possibly have something to do with the new CacheFileHandler(), I haven't used this before and I'm unaware of the syntax.
@Peter-Schorn commented on GitHub (Apr 20, 2021):
It has nothing to do with the
CacheFileHandler(what makes you think that?). This class contains the same caching logic as before. What error do you get when you try to make a request with the invalid token? And why do you have to change your Spotify password? I've never had to change my password.@shillshocked commented on GitHub (Apr 20, 2021):
I was reading the changelog and it looks as if the old way of doing things has been deprecated.
Deprecate specifing cache_path or username directly to SpotifyOAuth, SpotifyPKCE, and SpotifyImplicitGrant constructors, instead directing users to use the CacheFileHandler cache handlerYeah, I don't know, I get that issue once in a while (maybe months, could be more frequently).
Anyways, I messed around a bit more with the code, and I managed to get the scripts running again.
Just curious, can you give me an example of how to use CacheFileHandler in a code snippet? Because I am still using the username authorization.
@Peter-Schorn commented on GitHub (Apr 20, 2021):
Some of these parameters can be set in the environment variables. See the documentation comments for more information.
You may get an extraneous warning message as described in #674. Ignore it.
@Peter-Schorn commented on GitHub (Apr 20, 2021):
What error message are you getting when you try to use an invalid token? I'm curious. Do you get a message saying "Refresh token revoked"?
@shillshocked commented on GitHub (Apr 20, 2021):
Thanks. Initially the problem was: spotipy "Couldn't refresh token: code:400," but that was just one of the errors.
I deleted the cached token. Made a new app. Put the new variables in to the .bashrc (and any reference in the python code, if applicable). That seemed to get things working. I had a few other issues but that was my own due to a recent update I made.
Sometimes you have to reset your client secret or make a new app to get things working again if your account is bugged. I think this happens every time you reset your password or if your account has been having login issues (perhaps a security feature of Spotify).
If the issue continues more often, I might make an automated way to speed up the reset/redeployment for future occurrences.
@Peter-Schorn commented on GitHub (Apr 20, 2021):
If you get a "Couldn't refresh token: code:400," error, then you should only need to delete the cached token info. You shouldn't need to create a new developer application. Try only deleting the cached token info next time.