[GH-ISSUE #328] [BUG] 429: API rate limit exceeded when using tokens with Spotify API #62

Open
opened 2026-02-27 08:11:43 +03:00 by kerem · 1 comment
Owner

Originally created by @malmeloo on GitHub (Dec 30, 2025).
Original GitHub issue: https://github.com/kokarare1212/librespot-python/issues/328

Describe the bug
Using session.tokens().get_token(...) to generate tokens for the Spotify Web API seems to not work anymore, as requests using these tokens always result in a 429 response, even though rate limits are not actually being hit (fresh IP, fresh account, works on desktop and works with a known valid token).

To Reproduce
Example with /me/tracks given a session:

    token = session.tokens().get_token(
        "user-read-email",
        "playlist-read-private",
        "user-library-read",
        "user-follow-read",
    )
    headers = {
        "Authorization": f"Bearer {token.access_token}",
    }
    params = {
        "limit": 50,
        "offset": 0
    }

    r = httpx.get(url, headers=headers, params=params)
    print(r.json())
    r.raise_for_status()

Returns:

{'error': {'status': 429, 'message': 'API rate limit exceeded'}}

Expected behavior
A proper response from the API. If you swap out the token above for one obtained from Spotify themselves (e.g. by intercepting a network request while testing an endpoint on the developer website), the request succeeds.

Client Information (please complete the following information):

  • OS: Linux (NixOS 25.11)
  • Python Version: 3.12.8
  • Library Version: latest commit (dafd5392f8)
Originally created by @malmeloo on GitHub (Dec 30, 2025). Original GitHub issue: https://github.com/kokarare1212/librespot-python/issues/328 **Describe the bug** Using `session.tokens().get_token(...)` to generate tokens for the Spotify Web API seems to not work anymore, as requests using these tokens always result in a 429 response, even though rate limits are not actually being hit (fresh IP, fresh account, works on desktop and works with a known valid token). **To Reproduce** Example with `/me/tracks` given a `session`: ```py token = session.tokens().get_token( "user-read-email", "playlist-read-private", "user-library-read", "user-follow-read", ) headers = { "Authorization": f"Bearer {token.access_token}", } params = { "limit": 50, "offset": 0 } r = httpx.get(url, headers=headers, params=params) print(r.json()) r.raise_for_status() ``` Returns: ``` {'error': {'status': 429, 'message': 'API rate limit exceeded'}} ``` **Expected behavior** A proper response from the API. If you swap out the token above for one obtained from Spotify themselves (e.g. by intercepting a network request while testing an endpoint on the [developer website](https://developer.spotify.com/documentation/web-api/reference/get-users-saved-tracks)), the request succeeds. **Client Information (please complete the following information):** - OS: Linux (NixOS 25.11) - Python Version: 3.12.8 - Library Version: latest commit (dafd5392f85331744de40bb40e762e5317da47fd)
Author
Owner

@NovedadesTelegram commented on GitHub (Jan 8, 2026):

‘Retry after 86400’ error
I am having this error, locally it lets me download librespot but I get that error on my server. It's strange

<!-- gh-comment-id:3724431163 --> @NovedadesTelegram commented on GitHub (Jan 8, 2026): ‘Retry after 86400’ error I am having this error, locally it lets me download librespot but I get that error on my server. It's strange
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot-python-kokarare1212#62
No description provided.