<?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: Refresh token revoked in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Refresh-token-revoked/m-p/5190866#M2408</link>
    <description>&lt;P&gt;Hi @Hubo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply. It's definitely not the secon point but could be the first. What I am doing is using setTimeout to trigger teh refresh token call after a certain time. Maybe if the user has closed their laptop or something it could cause the setTimeout to not fire. Any thoughts on that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;axios.post(`https://accounts.spotify.com/api/token`, params, config)
    .then(response =&amp;gt; {
      let access_token = response.data.access_token
      let refresh_token = response.data.refresh_token
      let expires_in = response.data.expires_in
      commit('SET_ACCESS_TOKEN', access_token)
      commit('SET_REFRESH_TOKEN', refresh_token)
      dispatch('initPlayer')

      let now = new Date()
      now.setSeconds(now.getSeconds() + expires_in);
      commit('SET_EXPIRES_AT', now)

      let timeout = (expires_in * 1000) - 10000
      console.log('settimeout')
      setTimeout(() =&amp;gt; {
        console.log('timeout triggered')
        dispatch('refreshToken')
      }, timeout)
    })&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 19 Apr 2021 12:53:39 GMT</pubDate>
    <dc:creator>chrishipgrave</dc:creator>
    <dc:date>2021-04-19T12:53:39Z</dc:date>
    <item>
      <title>Refresh token revoked</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Refresh-token-revoked/m-p/5190755#M2405</link>
      <description>&lt;P&gt;I am using PKCE for my web app. When a user tries to perform an action and the access token has expired, I use the refresh token to generate a new access token. If my webapp is idle for over a day, and I try to use the refresh token, I get the following: &lt;SPAN&gt;oken&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;status: 400&lt;/P&gt;&lt;P&gt;error: 'Refresh token revoked'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot see anywhere online which mentions the refresh token automatically getting revoked. Should this happen? Do I need to get the user to re-auth when it does happen?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 09:04:13 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Refresh-token-revoked/m-p/5190755#M2405</guid>
      <dc:creator>chrishipgrave</dc:creator>
      <dc:date>2021-04-19T09:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh token revoked</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Refresh-token-revoked/m-p/5190859#M2406</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.spotify.com/t5/user/viewprofilepage/user-id/24538420"&gt;@chrishipgrave&lt;/a&gt;, thanks for your post here!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Hmm, I have taken a look and it seems that this might happen due to the following reasons:&lt;/P&gt;&lt;P&gt;- A refresh token that has been obtained through PKCE can be exchanged for an access token only once, after which it becomes invalid.&lt;/P&gt;&lt;P&gt;- The user revoked this app from their account&lt;/P&gt;&lt;P&gt;Could you let me know if any of these reasons are the case? Keep me in loop!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Happy coding,&lt;/P&gt;&lt;P&gt;Hubo&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 12:41:17 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Refresh-token-revoked/m-p/5190859#M2406</guid>
      <dc:creator>Hubo</dc:creator>
      <dc:date>2021-04-19T12:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh token revoked</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Refresh-token-revoked/m-p/5190866#M2408</link>
      <description>&lt;P&gt;Hi @Hubo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply. It's definitely not the secon point but could be the first. What I am doing is using setTimeout to trigger teh refresh token call after a certain time. Maybe if the user has closed their laptop or something it could cause the setTimeout to not fire. Any thoughts on that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;axios.post(`https://accounts.spotify.com/api/token`, params, config)
    .then(response =&amp;gt; {
      let access_token = response.data.access_token
      let refresh_token = response.data.refresh_token
      let expires_in = response.data.expires_in
      commit('SET_ACCESS_TOKEN', access_token)
      commit('SET_REFRESH_TOKEN', refresh_token)
      dispatch('initPlayer')

      let now = new Date()
      now.setSeconds(now.getSeconds() + expires_in);
      commit('SET_EXPIRES_AT', now)

      let timeout = (expires_in * 1000) - 10000
      console.log('settimeout')
      setTimeout(() =&amp;gt; {
        console.log('timeout triggered')
        dispatch('refreshToken')
      }, timeout)
    })&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 Apr 2021 12:53:39 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Refresh-token-revoked/m-p/5190866#M2408</guid>
      <dc:creator>chrishipgrave</dc:creator>
      <dc:date>2021-04-19T12:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh token revoked</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Refresh-token-revoked/m-p/5848636#M12495</link>
      <description>&lt;P&gt;Hi Hubo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having the same issue. I want to get a refresh token every so often and use that refresh to get a new access token to get my recently played songs. Do you have any advice? I am using Python. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 03:56:04 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Refresh-token-revoked/m-p/5848636#M12495</guid>
      <dc:creator>martinweiss</dc:creator>
      <dc:date>2024-01-30T03:56:04Z</dc:date>
    </item>
  </channel>
</rss>

