[BUG] 429: API rate limit exceeded when using tokens with Spotify API
bug
**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)
1 条评论