[GH-ISSUE #361] Issue with _get_access_token #212

Closed
opened 2026-02-27 23:21:24 +03:00 by kerem · 2 comments
Owner

Originally created by @amc40 on GitHub (Mar 17, 2019).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/361

Even when provided with a valid code the response status code will still be 200, causing a spotipy.oauth2.SpotifyOauthError: Bad Request error. Using the pycharm debugger I stepped into the code and saw that the response had a valid authentication code and reason = OK, however the response code was still 200 (see attached screenshot). Unless this is a design choice I would suggest that it could possibly be fixed by checking instead that the status_code was not 'OK'.
Spotipy Screenshot

Originally created by @amc40 on GitHub (Mar 17, 2019). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/361 Even when provided with a valid code the response status code will still be 200, causing a spotipy.oauth2.SpotifyOauthError: Bad Request error. Using the pycharm debugger I stepped into the code and saw that the response had a valid authentication code and reason = OK, however the response code was still 200 (see attached screenshot). Unless this is a design choice I would suggest that it could possibly be fixed by checking instead that the status_code was not 'OK'. ![Spotipy Screenshot](https://user-images.githubusercontent.com/36701168/54492895-5cd79b80-48c2-11e9-9e11-29142e3fe128.png)
kerem closed this issue 2026-02-27 23:21:24 +03:00
Author
Owner

@FryPhilip commented on GitHub (Apr 16, 2019):

Hey, I get the same error. Same 200 code and OK string as reason. How did you fix that? Nothing I tried would fix that.

I tried adding the 'enable shuffle' function but at line 76 in oath2.py
(raise SpotifyOauthError(response.reason)
the debug triggers. error code is:
spotipy.oauth2.SpotifyOauthError: OK

and the method I added to client.py
def player_shuffle(self, state=None):
return self._put('me/player/shuffle', state=state)

Edit: never mind, the pycharm library wasn't updated, just download it from this GitHub and replace the files in your project

<!-- gh-comment-id:483677224 --> @FryPhilip commented on GitHub (Apr 16, 2019): Hey, I get the same error. Same 200 code and OK string as reason. How did you fix that? Nothing I tried would fix that. I tried adding the 'enable shuffle' function but at line 76 in oath2.py (raise SpotifyOauthError(response.reason) the debug triggers. error code is: spotipy.oauth2.SpotifyOauthError: OK and the method I added to client.py def player_shuffle(self, state=None): return self._put('me/player/shuffle', state=state) Edit: never mind, the pycharm library wasn't updated, just download it from this GitHub and replace the files in your project
Author
Owner

@stephanebruckert commented on GitHub (Jan 13, 2020):

Edit: never mind, the pycharm library wasn't updated, just download it from this GitHub and replace the files in your project

Fixed by 2.5.0

<!-- gh-comment-id:573885781 --> @stephanebruckert commented on GitHub (Jan 13, 2020): > Edit: never mind, the pycharm library wasn't updated, just download it from this GitHub and replace the files in your project Fixed by [2.5.0](https://github.com/plamere/spotipy/releases/tag/2.5.0)
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/spotipy#212
No description provided.