<?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: Get currently playing track API - Getting a 400 &amp;amp; 404 error in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Get-currently-playing-track-API-Getting-a-400-amp-404-error/m-p/5580716#M9212</link>
    <description>&lt;P&gt;I was&amp;nbsp;using the fetch API to make a request. I am trying to create a widget that shows my currently playing track. As I understand Spotify recommends using&amp;nbsp;&amp;nbsp;Authorization Code with PKCE Flow for SPA's, My question would be how can I make this a one time authorization without making additional requests?.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Sorry I am still a beginner, and your help is very much appreciated, thank you for your patience! &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 14 May 2023 09:14:37 GMT</pubDate>
    <dc:creator>orangeSunshine901</dc:creator>
    <dc:date>2023-05-14T09:14:37Z</dc:date>
    <item>
      <title>Get currently playing track API - Getting a 400 &amp; 404 error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Get-currently-playing-track-API-Getting-a-400-amp-404-error/m-p/5580588#M9207</link>
      <description>&lt;P&gt;Premium- Family Plan&lt;/P&gt;&lt;P&gt;United Arab Emirates&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use the Get currently playing track API and I am getting 400 &amp;amp; 404&amp;nbsp; error "&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Only valid bearer authentication supported" &amp;amp; "Invalid Username" , I am able to use the Search API which works perfectly fine!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&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;LI-CODE lang="javascript"&gt;async function getNowPlaying(){
    const nowPlayingParameters = {
      method: "GET",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${accessToken}`
      }
    }

    const res = await fetch(`https://api.spotify.com/v1/me/player/currently-playing?market=AE&amp;amp;additional_types=track`, nowPlayingParameters)

    const json = await res.json()
    console.log(json)
}&lt;/LI-CODE&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>Sat, 13 May 2023 23:03:14 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Get-currently-playing-track-API-Getting-a-400-amp-404-error/m-p/5580588#M9207</guid>
      <dc:creator>orangeSunshine901</dc:creator>
      <dc:date>2023-05-13T23:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get currently playing track API - Getting a 400 &amp; 404 error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Get-currently-playing-track-API-Getting-a-400-amp-404-error/m-p/5580696#M9210</link>
      <description>&lt;P&gt;How do you get an access token? To use that endpoint, you'll need to get an access token through the &lt;A href="https://developer.spotify.com/documentation/web-api/tutorials/code-flow" target="_blank" rel="noopener"&gt;Authorization Code Flow&lt;/A&gt; or the&amp;nbsp;&lt;A href="https://developer.spotify.com/documentation/web-api/tutorials/code-pkce-flow" target="_blank" rel="noopener"&gt;Authorization Code with PKCE Flow&lt;/A&gt;&lt;SPAN&gt;, and using the &lt;A href="https://developer.spotify.com/documentation/web-api/concepts/scopes" target="_blank" rel="noopener"&gt;Scopes&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;EM&gt;user-read-playback-state&lt;/EM&gt; and&amp;nbsp;&lt;EM&gt;user-read-currently-playing&lt;/EM&gt;.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 07:27:22 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Get-currently-playing-track-API-Getting-a-400-amp-404-error/m-p/5580696#M9210</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-05-14T07:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get currently playing track API - Getting a 400 &amp; 404 error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Get-currently-playing-track-API-Getting-a-400-amp-404-error/m-p/5580716#M9212</link>
      <description>&lt;P&gt;I was&amp;nbsp;using the fetch API to make a request. I am trying to create a widget that shows my currently playing track. As I understand Spotify recommends using&amp;nbsp;&amp;nbsp;Authorization Code with PKCE Flow for SPA's, My question would be how can I make this a one time authorization without making additional requests?.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Sorry I am still a beginner, and your help is very much appreciated, thank you for your patience! &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 09:14:37 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Get-currently-playing-track-API-Getting-a-400-amp-404-error/m-p/5580716#M9212</guid>
      <dc:creator>orangeSunshine901</dc:creator>
      <dc:date>2023-05-14T09:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get currently playing track API - Getting a 400 &amp; 404 error</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Get-currently-playing-track-API-Getting-a-400-amp-404-error/m-p/5580773#M9214</link>
      <description>&lt;P&gt;To achieve your intended goal, you must use the Authorization Code Flow as it is the only flow that supports refresh tokens. You should create a server-side script that can retrieve your currently playing track using the relevant endpoints. To do this, your script should use the access token that you've stored in a dynamic database on the server-side.&lt;/P&gt;&lt;P&gt;When you request an access token, you will also receive a refresh token that your script can use to refresh the access token when it has expired.&lt;/P&gt;&lt;P&gt;On the client-side, you should configure requests to be sent every twenty seconds to retrieve the currently playing track data from the server-side script.&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 13:30:09 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Get-currently-playing-track-API-Getting-a-400-amp-404-error/m-p/5580773#M9214</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-05-14T13:30:09Z</dc:date>
    </item>
  </channel>
</rss>

