<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Douglas MacKrell</title>
    <description>The latest articles on DEV Community by Douglas MacKrell (@inventivehero).</description>
    <link>https://dev.to/inventivehero</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3743024%2Fd5d3b40f-4abf-4740-8bf1-958fdf4d6f59.png</url>
      <title>DEV Community: Douglas MacKrell</title>
      <link>https://dev.to/inventivehero</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/inventivehero"/>
    <language>en</language>
    <item>
      <title>Fixing SpotDL OAuth INVALID_CLIENT and 24 Hour Rate Limit Errors (Redirect URI Port Bug)</title>
      <dc:creator>Douglas MacKrell</dc:creator>
      <pubDate>Sat, 31 Jan 2026 03:05:54 +0000</pubDate>
      <link>https://dev.to/inventivehero/fixing-spotdl-oauth-invalidclient-and-24-hour-rate-limit-errors-redirect-uri-port-bug-3k90</link>
      <guid>https://dev.to/inventivehero/fixing-spotdl-oauth-invalidclient-and-24-hour-rate-limit-errors-redirect-uri-port-bug-3k90</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;If &lt;code&gt;spotdl --user-auth&lt;/code&gt; fails with &lt;code&gt;INVALID_CLIENT&lt;/code&gt; or you hit a 24-hour Spotify rate limit (&lt;code&gt;Retry after: 86400s&lt;/code&gt;), add this redirect URI to your Spotify Developer App:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:9900/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spotdl --no-cache --user-auth "SPOTIFY_URL"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;Recent versions of &lt;strong&gt;spotDL&lt;/strong&gt; use Spotify OAuth (browser-based login) when running with &lt;code&gt;--user-auth&lt;/code&gt;. This requires a local callback server and &lt;strong&gt;exact redirect URI matching&lt;/strong&gt; in the Spotify Developer Dashboard.&lt;/p&gt;

&lt;p&gt;In this case, spotDL was failing due to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spotify API returning a 24-hour rate limit (&lt;code&gt;Retry after: 86400s&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;OAuth redirect URI mismatch between spotDL and Spotify app settings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once the correct redirect URI was added, authentication succeeded and downloads resumed normally.&lt;/p&gt;




&lt;h2&gt;
  
  
  Symptoms
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1) Spotify Rate Limiting
&lt;/h3&gt;

&lt;p&gt;Terminal output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your application has reached a rate/request limit. Retry will occur after: 86400 s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Common causes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spotify client-credential quota exhausted&lt;/li&gt;
&lt;li&gt;Shared/default spotDL credentials throttled&lt;/li&gt;
&lt;li&gt;Spotify penalty window triggered&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  2) OAuth Redirect Error
&lt;/h3&gt;

&lt;p&gt;Browser error after running &lt;code&gt;--user-auth&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INVALID_CLIENT: Invalid redirect URI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or after clicking &lt;strong&gt;Agree&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Something went wrong
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cause:&lt;/p&gt;

&lt;p&gt;Spotify requires redirect URIs to match &lt;strong&gt;exactly&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Protocol (http vs https)&lt;/li&gt;
&lt;li&gt;Host (127.0.0.1 vs localhost)&lt;/li&gt;
&lt;li&gt;Port number&lt;/li&gt;
&lt;li&gt;Trailing slash&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this case, spotDL attempted to redirect to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:9900/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But the Spotify app settings only allowed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:9000/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This mismatch caused OAuth to fail.&lt;/p&gt;




&lt;h2&gt;
  
  
  Root Cause
&lt;/h2&gt;

&lt;p&gt;spotDL launches a temporary local callback server during OAuth login.&lt;/p&gt;

&lt;p&gt;On macOS in this environment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;spotDL selected port &lt;strong&gt;9900&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Spotify app only allowed port &lt;strong&gt;9000&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Redirect mismatch blocked authorization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: The callback port can vary by environment and version. Always match the &lt;strong&gt;exact port shown in the browser OAuth URL&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;Add the exact callback URI used by spotDL into your Spotify Developer App settings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Required Redirect URI
&lt;/h3&gt;

&lt;p&gt;Add the following to your Spotify app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:9900/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Important:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Include &lt;code&gt;http&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Include port &lt;code&gt;9900&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Include trailing slash &lt;code&gt;/&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Spotify may display a warning about insecure redirect URIs. This is expected for localhost callbacks and does not prevent functionality.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step-by-Step Fix
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1 — Open Spotify Developer Dashboard
&lt;/h3&gt;

&lt;p&gt;Go to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://developer.spotify.com/dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Select your application.&lt;/p&gt;




&lt;h3&gt;
  
  
  Step 2 — Add Redirect URI
&lt;/h3&gt;

&lt;p&gt;Navigate to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Edit Settings → Redirect URIs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:9900/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  Step 3 — Run spotDL With User Auth
&lt;/h3&gt;

&lt;p&gt;Use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spotdl --no-cache --user-auth "https://open.spotify.com/album/ALBUM_ID"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spotdl --no-cache --user-auth "https://open.spotify.com/album/6pZj4nvx6lV3ulIK3BSjvs"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Step 4 — Complete Browser Authorization
&lt;/h3&gt;

&lt;p&gt;spotDL will:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a Spotify login window&lt;/li&gt;
&lt;li&gt;Prompt for account permission&lt;/li&gt;
&lt;li&gt;Redirect back to the local callback server&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Click &lt;strong&gt;Agree&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If configured correctly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Browser redirects successfully&lt;/li&gt;
&lt;li&gt;Terminal resumes execution&lt;/li&gt;
&lt;li&gt;Album download begins&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Optional Diagnostics
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Verify Callback Server Is Listening
&lt;/h3&gt;

&lt;p&gt;Before clicking &lt;strong&gt;Agree&lt;/strong&gt;, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lsof -nP -iTCP:9900 -sTCP:LISTEN
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3  &amp;lt;pid&amp;gt;  LISTEN  127.0.0.1:9900
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If no process is listening:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;spotDL exited early&lt;/li&gt;
&lt;li&gt;Another application is already using the port&lt;/li&gt;
&lt;li&gt;Firewall or security software is blocking localhost callbacks&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Command Flow Comparison
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Pre-Fix (Broken)
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Client Credentials Attempt
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spotdl "https://open.spotify.com/album/..."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Retry will occur after: 86400 s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  OAuth Attempt (Redirect Mismatch)
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spotdl --user-auth "https://open.spotify.com/album/..."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Browser result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INVALID_CLIENT: Invalid redirect URI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Something went wrong
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Post-Fix (Working)
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Correct OAuth Flow
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spotdl --no-cache --user-auth "https://open.spotify.com/album/..."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected behavior:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spotify consent page opens&lt;/li&gt;
&lt;li&gt;Authorization succeeds&lt;/li&gt;
&lt;li&gt;spotDL resumes&lt;/li&gt;
&lt;li&gt;Album downloads successfully&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Recommended Stable Usage
&lt;/h2&gt;

&lt;p&gt;To reduce Spotify throttling risk:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spotdl --threads 1 --user-auth "SPOTIFY_URL"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Single-threaded downloads reduce burst API usage and help avoid triggering Spotify rate limits.&lt;/p&gt;




&lt;h2&gt;
  
  
  Cache Reset (If Problems Reappear)
&lt;/h2&gt;

&lt;p&gt;If spotDL becomes stuck or reuses broken auth tokens:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rm -rf ~/.spotdl ~/.config/spotdl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then re-run OAuth authentication.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;spotDL now relies on browser OAuth for reliable Spotify access&lt;/li&gt;
&lt;li&gt;Redirect URI values must match exactly&lt;/li&gt;
&lt;li&gt;OAuth avoids aggressive Spotify API rate limits&lt;/li&gt;
&lt;li&gt;Port mismatches are the most common failure cause&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Status
&lt;/h2&gt;

&lt;p&gt;OAuth authentication confirmed working after adding:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:9900/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;spotDL downloads functioning normally on macOS + Chrome browser.&lt;/p&gt;




&lt;h2&gt;
  
  
  Related GitHub issue discussion
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/spotDL/spotify-downloader/issues/2585" rel="noopener noreferrer"&gt;https://github.com/spotDL/spotify-downloader/issues/2585&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

</description>
      <category>spotify</category>
      <category>opensource</category>
      <category>cli</category>
      <category>python</category>
    </item>
  </channel>
</rss>
