[GH-ISSUE #331] Insufficient client scope #191

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

Originally created by @shillshocked on GitHub (Oct 17, 2018).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/331

When using create_playlist.py

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/spotipy/client.py", line 121, in _internal_call
    r.raise_for_status()
  File "/usr/lib/python3.7/site-packages/requests/models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/users/myusername/playlists

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/destiny/Scripts/create_playlist.py", line 26, in <module>
    playlist_description)
  File "/usr/lib/python3.7/site-packages/spotipy/client.py", line 415, in user_playlist_create
    return self._post("users/%s/playlists" % (user,), payload=data)
  File "/usr/lib/python3.7/site-packages/spotipy/client.py", line 180, in _post
    return self._internal_call('POST', url, payload, kwargs)
  File "/usr/lib/python3.7/site-packages/spotipy/client.py", line 126, in _internal_call
    headers=r.headers)
spotipy.client.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/users/myusername/playlists:
 Insufficient client scope

No idea how to increase the scope with a localhost token.

Originally created by @shillshocked on GitHub (Oct 17, 2018). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/331 When using create_playlist.py ``` Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/spotipy/client.py", line 121, in _internal_call r.raise_for_status() File "/usr/lib/python3.7/site-packages/requests/models.py", line 939, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/users/myusername/playlists During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/destiny/Scripts/create_playlist.py", line 26, in <module> playlist_description) File "/usr/lib/python3.7/site-packages/spotipy/client.py", line 415, in user_playlist_create return self._post("users/%s/playlists" % (user,), payload=data) File "/usr/lib/python3.7/site-packages/spotipy/client.py", line 180, in _post return self._internal_call('POST', url, payload, kwargs) File "/usr/lib/python3.7/site-packages/spotipy/client.py", line 126, in _internal_call headers=r.headers) spotipy.client.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/users/myusername/playlists: Insufficient client scope ``` No idea how to increase the scope with a localhost token.
kerem closed this issue 2026-02-27 23:21:18 +03:00
Author
Owner

@shillshocked commented on GitHub (Oct 17, 2018):

I was able to fix it by editing the code of create_playlist.py:

token = util.prompt_for_user_token(username)

scope = 'playlist-modify-public playlist-modify-private'
token = util.prompt_for_user_token(username, scope)

<!-- gh-comment-id:430479760 --> @shillshocked commented on GitHub (Oct 17, 2018): I was able to fix it by editing the code of create_playlist.py: token = util.prompt_for_user_token(username) scope = 'playlist-modify-public playlist-modify-private' token = util.prompt_for_user_token(username, scope)
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#191
No description provided.