<?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 refresh token always invalid in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/refresh-token-always-invalid/m-p/5617100#M10186</link>
    <description>&lt;P&gt;so, i have a personal project where i want to achieve my currently playing tracks from spotify to my website. i run it in localhost:3000/ and i set the redirect uri to localhost:3000/callback. so when i authorized my account and got the refresh token, i put it into my code, but when i ran the code it keeps telling me error 400. where the response says 'invalid grant type' and the description says 'invalid refresh token'. but i'm pretty sure the refresh token is right and newly generated. so here's the code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;            const token = Buffer.from(`${client_id}:${client_secret}`).toString('base64');
            const accessToken = await axios({
                method: 'post',
                url: 'https://accounts.spotify.com/api/token',
                data: `grant_type=refresh_token&amp;amp;refresh_token=${refresh_token}`,
                headers: {
                    Authorization: `Basic ${token}`,
                    'Content-Type': 'application/x-www-form-urlencoded'
                }
            });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;but other than refresh token, i suspect the error came from the url. everytime i opened&amp;nbsp;&lt;A href="https://accounts.spotify.com/api/token" target="_blank" rel="noopener"&gt;https://accounts.spotify.com/api/token&lt;/A&gt;&amp;nbsp;it always showing picture below.&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="raaaizaa_0-1690877193477.png" style="width: 400px;"&gt;&lt;img src="https://community.spotify.com/t5/image/serverpage/image-id/160646i5EA33A7A28E63D0B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="raaaizaa_0-1690877193477.png" alt="raaaizaa_0-1690877193477.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so now i'm confused where i did wrong&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 01 Aug 2023 08:11:24 GMT</pubDate>
    <dc:creator>raaaizaa</dc:creator>
    <dc:date>2023-08-01T08:11:24Z</dc:date>
    <item>
      <title>refresh token always invalid</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/refresh-token-always-invalid/m-p/5617100#M10186</link>
      <description>&lt;P&gt;so, i have a personal project where i want to achieve my currently playing tracks from spotify to my website. i run it in localhost:3000/ and i set the redirect uri to localhost:3000/callback. so when i authorized my account and got the refresh token, i put it into my code, but when i ran the code it keeps telling me error 400. where the response says 'invalid grant type' and the description says 'invalid refresh token'. but i'm pretty sure the refresh token is right and newly generated. so here's the code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;            const token = Buffer.from(`${client_id}:${client_secret}`).toString('base64');
            const accessToken = await axios({
                method: 'post',
                url: 'https://accounts.spotify.com/api/token',
                data: `grant_type=refresh_token&amp;amp;refresh_token=${refresh_token}`,
                headers: {
                    Authorization: `Basic ${token}`,
                    'Content-Type': 'application/x-www-form-urlencoded'
                }
            });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;but other than refresh token, i suspect the error came from the url. everytime i opened&amp;nbsp;&lt;A href="https://accounts.spotify.com/api/token" target="_blank" rel="noopener"&gt;https://accounts.spotify.com/api/token&lt;/A&gt;&amp;nbsp;it always showing picture below.&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="raaaizaa_0-1690877193477.png" style="width: 400px;"&gt;&lt;img src="https://community.spotify.com/t5/image/serverpage/image-id/160646i5EA33A7A28E63D0B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="raaaizaa_0-1690877193477.png" alt="raaaizaa_0-1690877193477.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so now i'm confused where i did wrong&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Aug 2023 08:11:24 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/refresh-token-always-invalid/m-p/5617100#M10186</guid>
      <dc:creator>raaaizaa</dc:creator>
      <dc:date>2023-08-01T08:11:24Z</dc:date>
    </item>
  </channel>
</rss>

