<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Persistent &amp;quot;Invalid Client&amp;quot; Error in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Persistent-quot-Invalid-Client-quot-Error/m-p/5636361#M10732</link>
    <description>&lt;P&gt;Your code works for me, but I had to copy and go to the URL displayed in the console, log in, and past the resulting URL back in the console. This is caused by the open_browser=False.&lt;/P&gt;&lt;P&gt;You can try to remove the .cache file from the active running directory and run the script again.&lt;/P&gt;</description>
    <pubDate>Thu, 14 Sep 2023 17:46:45 GMT</pubDate>
    <dc:creator>Ximzend</dc:creator>
    <dc:date>2023-09-14T17:46:45Z</dc:date>
    <item>
      <title>Persistent "Invalid Client" Error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Persistent-quot-Invalid-Client-quot-Error/m-p/5635424#M10716</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Plan&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Premium Family&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Country&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Canada&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Device&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Raspberry Pi 3B+&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Operating System&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Raspbian 11&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Question or Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I've created an app in the Developer Dashboard for a device I've created that uses a raspberry pi. However, when I try to authenticate the client/device, I get the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "/usr/local/lib/python3.9/dist-packages/spotipy/oauth2.py", line 588, in refresh_access_token&lt;BR /&gt;response.raise_for_status()&lt;BR /&gt;File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status&lt;BR /&gt;raise HTTPError(http_error_msg, response=self)&lt;BR /&gt;requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: &lt;A href="https://accounts.spotify.com/api/token" target="_blank" rel="noopener"&gt;https://accounts.spotify.com/api/token&lt;/A&gt;&lt;/P&gt;&lt;P&gt;During handling of the above exception, another exception occurred:&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "/home/pi/Desktop/QPTestScripts/getDevices.py", line 12, in &amp;lt;module&amp;gt;&lt;BR /&gt;devices = sp.devices()&lt;BR /&gt;File "/usr/local/lib/python3.9/dist-packages/spotipy/client.py", line 1748, in devices&lt;BR /&gt;return self._get("me/player/devices")&lt;BR /&gt;File "/usr/local/lib/python3.9/dist-packages/spotipy/client.py", line 323, in _get&lt;BR /&gt;return self._internal_call("GET", url, payload, kwargs)&lt;BR /&gt;File "/usr/local/lib/python3.9/dist-packages/spotipy/client.py", line 247, in _internal_call&lt;BR /&gt;headers = self._auth_headers()&lt;BR /&gt;File "/usr/local/lib/python3.9/dist-packages/spotipy/client.py", line 238, in _auth_headers&lt;BR /&gt;token = self.auth_manager.get_access_token(as_dict=False)&lt;BR /&gt;File "/usr/local/lib/python3.9/dist-packages/spotipy/oauth2.py", line 525, in get_access_token&lt;BR /&gt;token_info = self.validate_token(self.cache_handler.get_cached_token())&lt;BR /&gt;File "/usr/local/lib/python3.9/dist-packages/spotipy/oauth2.py", line 380, in validate_token&lt;BR /&gt;token_info = self.refresh_access_token(&lt;BR /&gt;File "/usr/local/lib/python3.9/dist-packages/spotipy/oauth2.py", line 596, in refresh_access_token&lt;BR /&gt;self._handle_oauth_error(http_error)&lt;BR /&gt;File "/usr/local/lib/python3.9/dist-packages/spotipy/oauth2.py", line 146, in _handle_oauth_error&lt;BR /&gt;raise SpotifyOauthError(&lt;BR /&gt;spotipy.oauth2.SpotifyOauthError: error: invalid_client, error_description: Invalid client&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've verified that the client ID, client secret, and redirect URI match what is in the app in the developer dashboard, and I've also checked that the scopes are correct. How can I resolve this issue? Your help is much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 05:16:25 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Persistent-quot-Invalid-Client-quot-Error/m-p/5635424#M10716</guid>
      <dc:creator>n39su59fav4b7fmcm0c</dc:creator>
      <dc:date>2023-09-13T05:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Persistent "Invalid Client" Error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Persistent-quot-Invalid-Client-quot-Error/m-p/5635454#M10717</link>
      <description>&lt;P&gt;I think you are using Client Credentials, but maybe the endpoint you are trying to use requires &lt;A href="https://github.com/spotipy-dev/spotipy#without-user-authentication" target="_blank" rel="noopener"&gt;User Authentication&lt;/A&gt;. (Is an assumption, because you haven't posted any code, and I can't figure it out with the error message alone.)&lt;/P&gt;&lt;P&gt;If you can't authenticate on the Pi, you can run the script on your desktop, login, and copy the .cache file to the directly the script is run from.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 05:39:17 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Persistent-quot-Invalid-Client-quot-Error/m-p/5635454#M10717</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-09-14T05:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Persistent "Invalid Client" Error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Persistent-quot-Invalid-Client-quot-Error/m-p/5635871#M10720</link>
      <description>&lt;P&gt;Hi Ximzend,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your reply! Here is the script that I'm trying to run to authenticate the pi and simply get the device ID:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import spotipy&lt;BR /&gt;from spotipy.oauth2 import SpotifyOAuth&lt;/P&gt;&lt;P&gt;# Set up the Spotipy client with your credentials&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id='&amp;lt;my_client_ID&amp;gt;', client_secret='&amp;lt;my_client_secret&amp;gt;', redirect_uri='&lt;A href="https://example.com/callback/" target="_blank"&gt;https://example.com/callback/&lt;/A&gt;', scope='user-read-playback-state, user-modify-playback-state', open_browser=False))&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Retrieve the list of available devices&lt;BR /&gt;devices = sp.devices()&lt;/P&gt;&lt;P&gt;# Iterate over the devices and print their details&lt;BR /&gt;for device in devices['devices']:&lt;BR /&gt;device_name = device['name']&lt;BR /&gt;device_id = device['id']&lt;BR /&gt;device_type = device['type']&lt;BR /&gt;print(f"Device Name: {device_name}, Device ID: {device_id}, Device Type: {device_type}")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've input the actual client secret and ID in my code and made sure they match what is in the developer dashboard, along with the redirect URI. Do you have any idea what may be happening? Thank you again for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 19:41:19 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Persistent-quot-Invalid-Client-quot-Error/m-p/5635871#M10720</guid>
      <dc:creator>n39su59fav4b7fmcm0c</dc:creator>
      <dc:date>2023-09-13T19:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: Persistent "Invalid Client" Error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Persistent-quot-Invalid-Client-quot-Error/m-p/5636361#M10732</link>
      <description>&lt;P&gt;Your code works for me, but I had to copy and go to the URL displayed in the console, log in, and past the resulting URL back in the console. This is caused by the open_browser=False.&lt;/P&gt;&lt;P&gt;You can try to remove the .cache file from the active running directory and run the script again.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 17:46:45 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Persistent-quot-Invalid-Client-quot-Error/m-p/5636361#M10732</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-09-14T17:46:45Z</dc:date>
    </item>
  </channel>
</rss>

