mirror of
https://github.com/Aran404/SpotAPI.git
synced 2026-04-25 16:55:50 +03:00
[GH-ISSUE #38] Spotify /api/token endpoint returns 400 - Unauthorized request (TOTP change) #24
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SpotAPI#24
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 @wassim01110111 on GitHub (Jun 30, 2025).
Original GitHub issue: https://github.com/Aran404/SpotAPI/issues/38
Version
Code trigggering the error
Response from Spotify
Notes
It appears Spotify has updated their TOTP flow. The new format seems to be:
It looks like the
totpVerhas changed (from5to8) and a new parametertotpServerwas added (equal tototp).@wassim01110111 commented on GitHub (Jun 30, 2025):
I have tried to do some digging and managed to find this
I haven't tested if any of those arrays work yet
@Aran404 commented on GitHub (Jun 30, 2025):
What code did you use? Need to reproduce the error
@wassim01110111 commented on GitHub (Jun 30, 2025):
I used the code available in the client.py file with the updated endpoint, the old one throws out this error:
Like I said, they switched to totpVer 8 so the previous method doesn't work anymore.
@WeiChaoZheng commented on GitHub (Jul 2, 2025):
I think I've found a solution
Update the spotapi/client.py file
And:
@wassim01110111 commented on GitHub (Jul 2, 2025):
I'm sorry to break it to you, but they've updated it to totpVer 9 and the TOTP secret you have shared is no longer valid.
@wassim01110111 commented on GitHub (Jul 2, 2025):
On the bright side, they don't seem to have changed much compared to the 8th version, the main difference is that totp and totpServer have different values. As long as you can figure out this function, you can pretty much reverse engineer the whole thing.
@WeiChaoZheng commented on GitHub (Jul 2, 2025):
version 9 only changes the SECRET; everything else remains the same
The safest way should be to use it
"seleniumwire" accesses and intercepts the acquisition.
@wassim01110111 commented on GitHub (Jul 2, 2025):
Hi @Aran404,
I’ve opened a pull request (#40) that should fix this issue.
Could you please check it out and see if it works on your end? Thanks!
@Aran404 commented on GitHub (Jul 8, 2025):
Hey, sorry I'm back. I'll have a look now
@Aran404 commented on GitHub (Jul 8, 2025):
Wassim's pull request was sufficient to fix the issue