mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #493] Error getting token info - JSONDecodeError: Expecting value: line 1 column 1 (char 0) #293
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#293
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 @tahsinac on GitHub (May 17, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/493
Hi, I've been using this library for a month daily on a simple script with no issues up until just now. I get this error now
Not sure what's causing this all of a sudden, there's been no change in the script.
@tahsinac commented on GitHub (May 17, 2020):
Also, i have the latest version of the package installed.
@stephanebruckert commented on GitHub (May 17, 2020):
@tahsinac I see you are using Windows. Can you please check if this https://github.com/plamere/spotipy/issues/470#issuecomment-612671070 helps
@tahsinac commented on GitHub (May 18, 2020):
Hi there, just tried it and I get a browser pop up sawing 'INVALID_CLIENT: Invalid redirect URI'. Strange as it was working just fine all this time and nothing has really changed. I went back to the Spotify web API dashboard and double checked my redirect URI. http://localhost:8888/callback/ is whitelisted.
@tahsinac commented on GitHub (May 18, 2020):
Follow-up:
Just retried running cmd.exe as admin after a quick restart and it seems to be working now.
Can you tell me why this issue came up all of a sudden and why running as admin fixed it?
@stephanebruckert commented on GitHub (May 19, 2020):
@tahsinac I'm really not sure what is happening, has something changed on spotipy or on windows?
Any chance you can try to downgrade spotipy and find which version succeeds? You can use:
That would be really helpful, thanks in advance
@tahsinac commented on GitHub (May 20, 2020):
Using the older versions prompt a INVALID_CLIENT: Invalid redirect URI pop up, although the redirect URI I'm using is whitelisted and has been in use for a while now with no issues.
@wired4life4 commented on GitHub (Jan 26, 2021):
Any fix for this ever found? I'm getting the same error. I did run my file in administrator cmd.exe and it worked and asked me to log in. In any IDE, however, it never asks to log in and gives this error.
Also looking at #567, it seems like I am required to have .cache-<username> file. A file '.cache' does not work. I am using the latest Spotipy 2.16.1
@stephanebruckert commented on GitHub (Jan 26, 2021):
@wired4life4 what's the content of your
.cachefile? (please make sure you falsify any token)If you can't see it, it's probably hidden.
If the file is empty, you should delete it before re-running your code.
@wired4life4 commented on GitHub (Jan 26, 2021):
@stephanebruckert Ah I just noticed I forgot to escape < > the angle brackets. The
.cache-<username>file is empty and was manually created. The same for the manually created.cachefile. Here is my sample script. My tokens are all stored locally in an .env file.Where my redirect URI is set in both the keys.env and developer dashboard as
The .cache* file is not created upon running this script multiple times. Thanks for the reply :)
@stephanebruckert commented on GitHub (Jan 26, 2021):
You shouldn't have any empty files, please delete all of them.
This is not a valid redirect URI:
Try with http://localhost:8080 instead
Also, double check or try both, but you might not need the single quotes when defining environment variables on Windows. So do:
Don't forget to update your Spotify app settings.
Now when you run your code, does it work and if not, what's displayed?
@wired4life4 commented on GitHub (Jan 26, 2021):
It works!! Ah I see. In the docs it seemed like as long as the URI matched between the app settings and the code, it should be okay, but it looks like this is not the case. I removed all
.cache*files and ran it within my keys.env file. Upon first running, the output is
however, the
.cache-usernamefile is created and populated with some key-value tokens. Subsequent runs give the output above without the warning message. Thank you!! You're help is very much appreciated :)@stephanebruckert commented on GitHub (Jan 27, 2021):
Cool!
I'm going to close this since empty files should never be created. If anyone's up for catching that exception and show a warning, feel free to open a PR