"Baseclienterror: could not get session auth tokens" error when trying to download track or album

Author: m-r0s3Created Jun 11, 2026Updated Sep 10, 2026
LabelsBugCannot Reproduce

System OS

Windows

Python Version

3.11 (CPython)

Install Source

pip / PyPi

Install version / commit hash

v4.5.0

Expected Behavior vs Actual Behavior

Expected to download track as normal (I hadn't used spotdl since before the API thing). Did not download and received "Baseclienterror" Tried again with an album, same result.

Steps to reproduce - Ensure to include actual links!

Prior info: I've had spotdl installed since November last year and had already put in my own client ID and secret

  1. ran "spotdl https://open.spotify.com/track/4lC5STpnrBm7aXMls2zGqJ?si=292a9ab785ce4996"
  2. received error
  3. tried again with album and got same error
  4. downloaded git (using all the default settings) and then the API workaround
  5. ran "spotdl https://open.spotify.com/track/4lC5STpnrBm7aXMls2zGqJ?si=292a9ab785ce4996" again
  6. same error received
  7. uninstalled and reinstalled spotdl
  8. error still received

Traceback

An error occurred
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\console\entry_point.py:160 in        │
│ entry_point                                                                                                          │
│                                                                                                                      │
│   157 │   try:                                                                                                       │
│   158 │   │   # Pick the operation to perform                                                                        │
│   159 │   │   # based on the name and run it!                                                                        │
│ ❱ 160 │   │   OPERATIONS[arguments.operation](                                                                       │
│   161 │   │   │   query=arguments.query,                                                                             │
│   162 │   │   │   downloader=downloader,                                                                             │
│   163 │   │   )                                                                                                      │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\console\download.py:25 in download   │
│                                                                                                                      │
│   22 │   """                                                                                                         │
│   23 │                                                                                                               │
│   24 │   # Parse the query                                                                                           │
│ ❱ 25 │   songs = get_simple_songs(                                                                                   │
│   26 │   │   query,                                                                                                  │
│   27 │   │   use_ytm_data=downloader.settings["ytm_data"],                                                           │
│   28 │   │   playlist_numbering=downloader.settings["playlist_numbering"],                                           │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\\\utils\search.py:266 in               │
│ get_simple_songs                                                                                                     │
│                                                                                                                      │
│   263 │   │   elif "open.spotify.com" in request and "playlist" in request:                                          │
│   264 │   │   │   lists.append(Playlist.from_url(request, fetch_songs=False))                                        │
│   265 │   │   elif "open.spotify.com" in request and "album" in request:                                             │
│ ❱ 266 │   │   │   lists.append(Album.from_url(request, fetch_songs=False))                                           │
│   267 │   │   elif "open.spotify.com" in request and "artist" in request:                                            │
│   268 │   │   │   lists.append(Artist.from_url(request, fetch_songs=False))                                          │
│   269 │   │   elif "open.spotify.com" in request and "user" in request:                                              │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\types\song.py:315 in from_url        │
│                                                                                                                      │
│   312 │   │   - The SongList object.                                                                                 │
│   313 │   │   """                                                                                                    │
│   314 │   │                                                                                                          │
│ ❱ 315 │   │   metadata, songs = cls.get_metadata(url)                                                                │
│   316 │   │   urls = [song.url for song in songs]                                                                    │
│   317 │   │                                                                                                          │
│   318 │   │   if fetch_songs:                                                                                        │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\types\album.py:42 in get_metadata    │
│                                                                                                                      │
│    39 │   │                                                                                                          │
│    40 │   │   spotify_client = SpotifyClient()                                                                       │
│    41 │   │                                                                                                          │
│ ❱  42 │   │   album_metadata = spotify_client.album(url)                                                             │
│    43 │   │   if album_metadata is None:                                                                             │
│    44 │   │   │   raise AlbumError(                                                                                  │
│    45 │   │   │   │   "Couldn't get metadata, check if you have passed correct album id"                             │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\SpotipyFree\Spotify.py:215 in album         │
│                                                                                                                      │
│   212 │   │   if self.isUrl(albumId):                                                                                │
│   213 │   │   │   albumId = self.urlToId(albumId)                                                                    │
│   214 │   │                                                                                                          │
│ ❱ 215 │   │   album = spotapi.PublicAlbum(albumId).get_album_info()["data"]["albumUnion"]                            │
│   216 │   │   artists = SpotifyFormatter.formatArtists(album["artists"]["items"])                                    │
│   217 │   │   tracks = SpotifyFormatter.formatTracks(album["tracksV2"]["items"])                                     │
│   218 │   │   return SpotifyFormatter.formatAlbum(album, artists, tracks)                                            │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotapi\types\annotations.py:47 in wrapper  │
│                                                                                                                      │
│    44 │   │   │   │   │   │   f"but got {format_type(type(arg_value))}"                                              │
│    45 │   │   │   │   │   )                                                                                          │
│    46 │   │                                                                                                          │
│ ❱  47 │   │   result: R = func(*args, **kwargs)                                                                      │
│    48 │   │                                                                                                          │
│    49 │   │   if return_type is not None and not is_instance_of(result, return_type):                                │
│    50 │   │   │   raise TypeError(                                                                                   │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotapi\album.py:59 in get_album_info       │
│                                                                                                                      │
│   56 │   │   │   │   {                                                                                               │
│   57 │   │   │   │   │   "persistedQuery": {                                                                         │
│   58 │   │   │   │   │   │   "version": 1,                                                                           │
│ ❱ 59 │   │   │   │   │   │   "sha256Hash": self.base.part_hash("getAlbum"),                                          │
│   60 │   │   │   │   │   }                                                                                           │
│   61 │   │   │   │   }                                                                                               │
│   62 │   │   │   ),                                                                                                  │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotapi\types\annotations.py:47 in wrapper  │
│                                                                                                                      │
│    44 │   │   │   │   │   │   f"but got {format_type(type(arg_value))}"                                              │
│    45 │   │   │   │   │   )                                                                                          │
│    46 │   │                                                                                                          │
│ ❱  47 │   │   result: R = func(*args, **kwargs)                                                                      │
│    48 │   │                                                                                                          │
│    49 │   │   if return_type is not None and not is_instance_of(result, return_type):                                │
│    50 │   │   │   raise TypeError(                                                                                   │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotapi\client.py:214 in part_hash          │
│                                                                                                                      │
│   211 │                                                                                                              │
│   212 │   def part_hash(self, name: str) -> str:                                                                     │
│   213 │   │   if self.raw_hashes is _Undefined:                                                                      │
│ ❱ 214 │   │   │   self.get_sha256_hash()                                                                             │
│   215 │   │                                                                                                          │
│   216 │   │   if self.raw_hashes is _Undefined:                                                                      │
│   217 │   │   │   raise ValueError("Could not get playlist hashes")                                                  │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotapi\types\annotations.py:47 in wrapper  │
│                                                                                                                      │
│    44 │   │   │   │   │   │   f"but got {format_type(type(arg_value))}"                                              │
│    45 │   │   │   │   │   )                                                                                          │
│    46 │   │                                                                                                          │
│ ❱  47 │   │   result: R = func(*args, **kwargs)                                                                      │
│    48 │   │                                                                                                          │
│    49 │   │   if return_type is not None and not is_instance_of(result, return_type):                                │
│    50 │   │   │   raise TypeError(                                                                                   │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotapi\client.py:226 in get_sha256_hash    │
│                                                                                                                      │
│   223 │                                                                                                              │
│   224 │   def get_sha256_hash(self) -> None:                                                                         │
│   225 │   │   if self.js_pack is _Undefined:                                                                         │
│ ❱ 226 │   │   │   self.get_session()                                                                                 │
│   227 │   │                                                                                                          │
│   228 │   │   if self.js_pack is _Undefined:                                                                         │
│   229 │   │   │   raise ValueError("Could not get playlist hashes")                                                  │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotapi\types\annotations.py:47 in wrapper  │
│                                                                                                                      │
│    44 │   │   │   │   │   │   f"but got {format_type(type(arg_value))}"                                              │
│    45 │   │   │   │   │   )                                                                                          │
│    46 │   │                                                                                                          │
│ ❱  47 │   │   result: R = func(*args, **kwargs)                                                                      │
│    48 │   │                                                                                                          │
│    49 │   │   if return_type is not None and not is_instance_of(result, return_type):                                │
│    50 │   │   │   raise TypeError(                                                                                   │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotapi\client.py:170 in get_session        │
│                                                                                                                      │
│   167 │   │                                                                                                          │
│   168 │   │   self.client_version = self.server_cfg["clientVersion"]                                                 │
│   169 │   │   self.device_id = self.client.cookies.get("sp_t") or ""                                                 │
│ ❱ 170 │   │   self._get_auth_vars()                                                                                  │
│   171 │                                                                                                              │
│   172 │   def get_client_token(self) -> None:                                                                        │
│   173 │   │   if not (self.client_id and self.device_id and self.client_version):                                    │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotapi\types\annotations.py:47 in wrapper  │
│                                                                                                                      │
│    44 │   │   │   │   │   │   f"but got {format_type(type(arg_value))}"                                              │
│    45 │   │   │   │   │   )                                                                                          │
│    46 │   │                                                                                                          │
│ ❱  47 │   │   result: R = func(*args, **kwargs)                                                                      │
│    48 │   │                                                                                                          │
│    49 │   │   if return_type is not None and not is_instance_of(result, return_type):                                │
│    50 │   │   │   raise TypeError(                                                                                   │
│                                                                                                                      │
│ C:\Users\M\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotapi\client.py:134 in _get_auth_vars     │
│                                                                                                                      │
│   131 │   │   │   resp = self.client.get("https://open.spotify.com/api/token", params=query)                         │
│   132 │   │   │                                                                                                      │
│   133 │   │   │   if resp.fail:

Source: spotDL/spotify-downloader