<?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: Token problem in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/6471573#M15389</link>
    <description>&lt;P&gt;&lt;SPAN&gt;no unfortunately not &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Oct 2024 13:30:15 GMT</pubDate>
    <dc:creator>XHyperDEVX</dc:creator>
    <dc:date>2024-10-30T13:30:15Z</dc:date>
    <item>
      <title>Token problem</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5620560#M10249</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Plan&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Premium&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Country&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;DE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Device&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Windows 11/MS Edge&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Operating System&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Windows 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 have an HTML page that is supposed to show me the currently playing song on my Spotify account. I have gotten as far as getting an access token and working with it. Unfortunately, I get these two errors in the browser console when retrieving the name of the current song:&lt;/P&gt;&lt;P&gt;- Invalid token scopes.&lt;BR /&gt;- This functionality is restricted to premium users only&lt;/P&gt;&lt;P&gt;The token is correct, I am sure. And it is associated with a premium account. Where could be the error?&lt;/P&gt;&lt;P&gt;I am very grateful for tips and help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 00:23:24 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5620560#M10249</guid>
      <dc:creator>XHyperDEVX</dc:creator>
      <dc:date>2023-08-09T00:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: Token problem</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5620612#M10251</link>
      <description>&lt;P&gt;Which flow are you using?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 05:26:38 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5620612#M10251</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-08-09T05:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Token problem</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5620672#M10255</link>
      <description>&lt;P&gt;This is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;Song played&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;script src="&lt;A href="https://sdk.scdn.co/spotify-player.js" target="_blank"&gt;https://sdk.scdn.co/spotify-player.js&lt;/A&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;lt;h1&amp;gt;Song:&amp;lt;/h1&amp;gt;&lt;BR /&gt;&amp;lt;div id="current-song"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;button onclick="authorize()"&amp;gt;Connect Spotify&amp;lt;/button&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;let accessToken = null;&lt;/P&gt;&lt;P&gt;function authorize() {&lt;BR /&gt;const clientId = "my-client-id";&lt;BR /&gt;const redirectUri = encodeURIComponent("&lt;A href="https://my-url-in-my-app" target="_blank"&gt;https://my-url-in-my-app&lt;/A&gt;");&lt;BR /&gt;const scope = "user-read-currently-playing";&lt;/P&gt;&lt;P&gt;const authUrl = `&lt;A href="https://accounts.spotify.com/authorize?client_id=${clientId}&amp;amp;redirect_uri=${redirectUri}&amp;amp;scope=${scope}&amp;amp;response_type=token&amp;amp;show_dialog=true" target="_blank"&gt;https://accounts.spotify.com/authorize?client_id=${clientId}&amp;amp;redirect_uri=${redirectUri}&amp;amp;scope=${scope}&amp;amp;response_type=token&amp;amp;show_dialog=true&lt;/A&gt;`;&lt;/P&gt;&lt;P&gt;window.location.href = authUrl;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;window.onSpotifyWebPlaybackSDKReady = () =&amp;gt; {&lt;BR /&gt;const token = window.location.hash.substr(1).split('&amp;amp;')[0].split('=')[1];&lt;BR /&gt;accessToken = token;&lt;BR /&gt;console.log(accessToken);&lt;/P&gt;&lt;P&gt;const player = new Spotify.Player({&lt;BR /&gt;name: 'Web Playback SDK',&lt;BR /&gt;getOAuthToken: cb =&amp;gt; { cb(token); }&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Error handling&lt;BR /&gt;player.addListener('initialization_error', ({ message }) =&amp;gt; { console.error(message); });&lt;BR /&gt;player.addListener('authentication_error', ({ message }) =&amp;gt; { console.error(message); });&lt;BR /&gt;player.addListener('account_error', ({ message }) =&amp;gt; { console.error(message); });&lt;BR /&gt;player.addListener('playback_error', ({ message }) =&amp;gt; { console.error(message); });&lt;/P&gt;&lt;P&gt;// Playback status updates&lt;BR /&gt;player.addListener('player_state_changed', state =&amp;gt; {&lt;BR /&gt;const { current_track } = state.track_window;&lt;BR /&gt;const { name, artists } = current_track;&lt;BR /&gt;const artistNames = artists.map(artist =&amp;gt; artist.name).join(', ');&lt;BR /&gt;document.getElementById('current-song').innerHTML = `Song: ${name} - ${artistNames}`;&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Connect to the player!&lt;BR /&gt;player.connect();&lt;BR /&gt;};&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;/LI-SPOILER&gt;</description>
      <pubDate>Wed, 09 Aug 2023 08:15:57 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5620672#M10255</guid>
      <dc:creator>XHyperDEVX</dc:creator>
      <dc:date>2023-08-09T08:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Token problem</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5620717#M10257</link>
      <description>&lt;P&gt;I think that code is not going to work, because making it requires more complex code.&lt;/P&gt;&lt;P&gt;Here is a GitHub repo you can use: &lt;A href="https://github.com/tthn0/Spotify-Readme" target="_blank"&gt;https://github.com/tthn0/Spotify-Readme&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 10:15:09 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5620717#M10257</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-08-09T10:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Token problem</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5620722#M10259</link>
      <description>&lt;P&gt;So it is not possible to show in a html page the currently played song? Only with the HTML page.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 10:31:30 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5620722#M10259</guid>
      <dc:creator>XHyperDEVX</dc:creator>
      <dc:date>2023-08-09T10:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Token problem</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5620781#M10261</link>
      <description>&lt;P&gt;No, because a access token expires in 60 minutes, and refreshing that needs to be done server side.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 13:03:19 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5620781#M10261</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-08-09T13:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Token problem</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5621012#M10268</link>
      <description>&lt;P&gt;But I can retrieve the current accesstoken every time I visit the page, can't I?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 22:35:11 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5621012#M10268</guid>
      <dc:creator>XHyperDEVX</dc:creator>
      <dc:date>2023-08-09T22:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Token problem</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5621179#M10272</link>
      <description>&lt;P&gt;The missing scope is &lt;EM&gt;user-read-playback-state&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;I thought you also wanted to show others what you are listening to. Sorry for the misunderstanding.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 09:37:30 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5621179#M10272</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-08-10T09:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Token problem</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5621840#M10298</link>
      <description>&lt;P&gt;Unfortunately, I still get the error message "Invalid token scopes." in my browser console. Apparently it is only because the scope is wrong. Or not? What could be the correct one?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 21:00:27 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/5621840#M10298</guid>
      <dc:creator>XHyperDEVX</dc:creator>
      <dc:date>2023-08-11T21:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: Token problem</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/6471364#M15385</link>
      <description>&lt;P&gt;Did you ever fix this? I took keep getting "Invalid token scopes" and I'm pretty sure my scopes are correct&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 10:57:42 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/6471364#M15385</guid>
      <dc:creator>temlabs</dc:creator>
      <dc:date>2024-10-30T10:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Token problem</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/6471573#M15389</link>
      <description>&lt;P&gt;&lt;SPAN&gt;no unfortunately not &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 13:30:15 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/6471573#M15389</guid>
      <dc:creator>XHyperDEVX</dc:creator>
      <dc:date>2024-10-30T13:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Token problem</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/6471625#M15390</link>
      <description>&lt;P&gt;If you are sure that your scopes are correct in your code but you are still getting invalid scopes, you might need to re-authenticate your user, just refreshing the token is not enough to update the scopes associated with the token.&lt;BR /&gt;&lt;BR /&gt;XHyperDEVX - looking at your code at the very least to use the Web Playback SDK you will need the streaming,&amp;nbsp;user-read-email and user-read-private scopes.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 14:14:01 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Token-problem/m-p/6471625#M15390</guid>
      <dc:creator>tomjaimz</dc:creator>
      <dc:date>2024-10-30T14:14:01Z</dc:date>
    </item>
  </channel>
</rss>

