mirror of
https://github.com/jpochyla/psst.git
synced 2026-04-27 07:25:52 +03:00
[PR #720] fix: Use separate Client ID for Web API and switch CDN to spclient to avoid 429 rate-limiting #679
Labels
No labels
api
bug
build
documentation
duplicate
enhancement
good first issue
help wanted
idea
invalid
linux
lowprio
macos
pull-request
upstream
windows
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/psst#679
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?
📋 Pull Request Information
Original PR: https://github.com/jpochyla/psst/pull/720
Author: @grenaad
Created: 2/21/2026
Status: 🔄 Open
Base:
main← Head:feat/separate-webapi-client-id📝 Commits (4)
95816fcfix: use separate Client ID for Web API calls to avoid 429 rate-limitinge1fd568fixed5662435review updatead11cfdreview update📊 Changes
10 files changed (+494 additions, -71 deletions)
View changed files
📝
psst-core/src/cdn.rs(+53 -23)📝
psst-core/src/connection/mod.rs(+25 -0)📝
psst-core/src/oauth.rs(+140 -16)📝
psst-core/src/session/access_token.rs(+22 -1)📝
psst-core/src/session/client_token.rs(+9 -2)📝
psst-core/src/session/login5.rs(+6 -6)📝
psst-gui/src/data/config.rs(+53 -0)📝
psst-gui/src/main.rs(+25 -1)📝
psst-gui/src/ui/preferences.rs(+124 -12)📝
psst-gui/src/webapi/client.rs(+37 -10)📄 Description
Disclosure
All code is generated with Opencode with Opus model. I tested this with my own client id, and auth is working. I have not used Rust in a few years, so I can't verify that the code quality is up to standard. I am happy to make any changes requested.
Summary
Spotify started returning 429 (Too Many Requests) errors for requests made to
api.spotify.comusing the official Spotify desktop client ID (65b708073fc0480ea92a077233ca87bd). This affects both the JSON Web API (search, library, playlists) and thestorage-resolveendpoint (audio file URL resolution for playback).This PR fixes both issues by:
api.spotify.comto Spotify'sspclientinfrastructure (same approach as librespot)Inspired by ncspot commit 6769b7b.
Setup: Register a Spotify app at https://developer.spotify.com/dashboard with redirect URI
http://127.0.0.1:8888/login, then enter the Client ID on the sign-in screen.Web API authentication
config.jsonWebApiToken(access token, refresh token, expiry) is stored inconfig.jsonalongside existing credentialsWebApino longer depends onLogin5orSessionService— it manages its own token viaset_webapi_credentials()CDN audio resolution (spclient migration)
Transport::resolve_spclient()to resolve spclient access points viaapresolve.spotify.com/?type=spclientCdn::resolve_audio_file_url()now useshttps://{spclient_host}/storage-resolve/...instead ofapi.spotify.comStorageResolveResponsefromlibrespot-protocol)client-tokenheader required by spclient endpointArc<ClientTokenProvider>is shared betweenLogin5andCdnto avoid redundant round-tripsCdninstance lifetimeOAuth code consolidation
create_spotify_oauth_client/create_webapi_oauth_clientintocreate_oauth_client(client_id, port)generate_auth_url/generate_webapi_auth_urlinto a shared parameterized functionclient_id: &str— no hardcoded constantopenandplatform-dirsdependencies removed frompsst-core; token persistence and browser-opening logic lives inpsst-guiArchitecture
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.