[GH-ISSUE #328] sp.next_track() : Not available for the current user #188

Closed
opened 2026-02-27 23:21:17 +03:00 by kerem · 1 comment
Owner

Originally created by @AlessandroMinervini on GitHub (Oct 9, 2018).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/328

Hi everyone,
i'm implementing a simple application with spotipy.
I want skip to the next track or pause, but i've this error in output:

spotipy.client.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/player/next:
Not available for the current user

My code is here:

`import os
import spotipy
import spotipy.util as util
from json.decoder import JSONDecodeError

username = 'myUserCode'
client_id = 'xxxxxxxxxxxx'
client_secret = 'xxxxxxxxxxxxx'
redirect_uri = 'https://www.xxxx.com/'
scope = 'user-modify-playback-state'

try:
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
except (AttributeError, JSONDecodeError):
os.remove(f".cache-{username}")
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)

sp = spotipy.Spotify(auth=token)
current = sp.next_track()`

Originally created by @AlessandroMinervini on GitHub (Oct 9, 2018). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/328 Hi everyone, i'm implementing a simple application with spotipy. I want skip to the next track or pause, but i've this error in output: spotipy.client.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/player/next: Not available for the current user My code is here: `import os import spotipy import spotipy.util as util from json.decoder import JSONDecodeError username = 'myUserCode' client_id = 'xxxxxxxxxxxx' client_secret = 'xxxxxxxxxxxxx' redirect_uri = 'https://www.xxxx.com/' scope = 'user-modify-playback-state' try: token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri) except (AttributeError, JSONDecodeError): os.remove(f".cache-{username}") token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri) sp = spotipy.Spotify(auth=token) current = sp.next_track()`
kerem closed this issue 2026-02-27 23:21:17 +03:00
Author
Owner

@qqrs commented on GitHub (Oct 11, 2018):

@AlessandroMinervini

One thing you might check:

https://developer.spotify.com/documentation/web-api/reference/player/skip-users-playback-to-next-track/

If the user making the request is non-premium, a 403 FORBIDDEN response code will be returned.

<!-- gh-comment-id:428804657 --> @qqrs commented on GitHub (Oct 11, 2018): @AlessandroMinervini One thing you might check: https://developer.spotify.com/documentation/web-api/reference/player/skip-users-playback-to-next-track/ > If the user making the request is non-premium, a 403 FORBIDDEN response code will be returned.
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#188
No description provided.