[GH-ISSUE #1205] Error 401 when requesting current_user_playing_track() #704

Closed
opened 2026-02-28 00:01:02 +03:00 by kerem · 1 comment
Owner

Originally created by @HappyTea1 on GitHub (Jun 20, 2025).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1205

Describe the bug
Sows error when trying to show current_user_playing_track(), but works with current_user_saved_tracks()
Both sould use the Auth code flow

Your code
import spotipy
from spotipy.oauth2 import SpotifyOAuth

sp = spotipy.Spotify(auth_manager=SpotifyOAuth(
client_id="CLIENT_ID",
client_secret="CLIENT_SECRET",
redirect_uri="https://spotify.com",
scope="user-library-read"))

result = sp.current_user_playing_track()
print(result)

Expected behavior
Print a json with the information of the track.

Output
HTTP Error for GET to https://api.spotify.com/v1/me/player/currently-playing with Params: {} returned 401 due to Permissions missing
Traceback (most recent call last):
File "C:\Users\name\AppData\Roaming\Python\Python310\site-packages\spotipy\client.py", line 274, in _internal_call
response.raise_for_status()
File "C:\Users\name\AppData\Roaming\Python\Python310\site-packages\requests\models.py", line 1026, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.spotify.com/v1/me/player/currently-playing

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\name\OneDrive\Documents\spotify song player\playerViewer.py", line 11, in
results = sp.current_user_playing_track()
File "C:\Users\name\AppData\Roaming\Python\Python310\site-packages\spotipy\client.py", line 1265, in current_user_playing_track
return self._get("me/player/currently-playing")
File "C:\Users\name\AppData\Roaming\Python\Python310\site-packages\spotipy\client.py", line 324, in _get
return self._internal_call("GET", url, payload, kwargs)
File "C:\Users\name\AppData\Roaming\Python\Python310\site-packages\spotipy\client.py", line 294, in _internal_call
raise SpotifyException(
spotipy.exceptions.SpotifyException: http status: 401, code: -1 - https://api.spotify.com/v1/me/player/currently-playing:
Permissions missing, reason: None

Environment:

  • OS: Windows
  • Python version: 3.10
  • spotipy version: 2.25.1
  • IDE: Thonny

Additional context
Verified client id and secret for errors.

Originally created by @HappyTea1 on GitHub (Jun 20, 2025). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1205 **Describe the bug** Sows error when trying to show current_user_playing_track(), but works with current_user_saved_tracks() Both sould use the Auth code flow **Your code** import spotipy from spotipy.oauth2 import SpotifyOAuth sp = spotipy.Spotify(auth_manager=SpotifyOAuth( client_id="CLIENT_ID", client_secret="CLIENT_SECRET", redirect_uri="https://spotify.com", scope="user-library-read")) result = sp.current_user_playing_track() print(result) **Expected behavior** Print a json with the information of the track. **Output** HTTP Error for GET to https://api.spotify.com/v1/me/player/currently-playing with Params: {} returned 401 due to Permissions missing Traceback (most recent call last): File "C:\Users\name\AppData\Roaming\Python\Python310\site-packages\spotipy\client.py", line 274, in _internal_call response.raise_for_status() File "C:\Users\name\AppData\Roaming\Python\Python310\site-packages\requests\models.py", line 1026, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.spotify.com/v1/me/player/currently-playing During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\name\OneDrive\Documents\spotify song player\playerViewer.py", line 11, in <module> results = sp.current_user_playing_track() File "C:\Users\name\AppData\Roaming\Python\Python310\site-packages\spotipy\client.py", line 1265, in current_user_playing_track return self._get("me/player/currently-playing") File "C:\Users\name\AppData\Roaming\Python\Python310\site-packages\spotipy\client.py", line 324, in _get return self._internal_call("GET", url, payload, kwargs) File "C:\Users\name\AppData\Roaming\Python\Python310\site-packages\spotipy\client.py", line 294, in _internal_call raise SpotifyException( spotipy.exceptions.SpotifyException: http status: 401, code: -1 - https://api.spotify.com/v1/me/player/currently-playing: Permissions missing, reason: None **Environment:** - OS: Windows - Python version: 3.10 - spotipy version: 2.25.1 - IDE: Thonny **Additional context** Verified client id and secret for errors.
kerem 2026-02-28 00:01:02 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@HappyTea1 commented on GitHub (Jun 20, 2025):

Scope not set correctly to user-read-currently-playing

<!-- gh-comment-id:2989481020 --> @HappyTea1 commented on GitHub (Jun 20, 2025): Scope not set correctly to user-read-currently-playing
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#704
No description provided.