<?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: Start/Resume Playback API return 401 in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Start-Resume-Playback-API-return-401/m-p/5319590#M3836</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had figured out the problem. There is a mistake with the Axios PUT call.&lt;/P&gt;&lt;P&gt;This is the correct way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const response = await axios.put(`https://api.spotify.com/v1/me/player/play?device_id=${player_id}`,
            {
                "context_uri": selectedTrack.album.uri,
                "offset": {
                    "position": selectedTrack.track_number
                },
                "position_ms": 0
            },
            {
                headers: {
                    Accept: 'application/json',
                    Authorization: 'Bearer ' + props.token,
                    'Content-Type': 'application/json'
                }
            })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Dec 2021 10:45:41 GMT</pubDate>
    <dc:creator>zhenyang</dc:creator>
    <dc:date>2021-12-24T10:45:41Z</dc:date>
    <item>
      <title>Start/Resume Playback API return 401</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Start-Resume-Playback-API-return-401/m-p/5317282#M3804</link>
      <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;I'm trying to use&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;PUT &lt;A href="https://api.spotify.com/v1/me/player/play" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;https://api.spotify.com/v1/me/player/play&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;to change a song using Axios, and I had provided the token, but I keep getting 401 error of token not provided.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Here is the code that I was using:&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const putRequest = async () =&amp;gt; {
            const response = await axios.put(`https://api.spotify.com/v1/me/player/play?device_id=${device_id}`,
            {
                headers: {
                    Accept: 'application/json',
                    Authorization: 'Bearer ' + props.token,
                    'Content-Type': 'application/json'
                },
                data: { uris: [track_uri] }
            })
        }

putRequest();&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;When I use the CONSOLE on the developer website and curl to send a put request to my player, it worked.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;When I use Axios, it didn't work. I don't know what I did wrong.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Dec 2021 14:18:14 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Start-Resume-Playback-API-return-401/m-p/5317282#M3804</guid>
      <dc:creator>zhenyang</dc:creator>
      <dc:date>2021-12-18T14:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Resume Playback API return 401</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Start-Resume-Playback-API-return-401/m-p/5317677#M3810</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.spotify.com/t5/user/viewprofilepage/user-id/25057028"&gt;@zhenyang&lt;/a&gt;, thanks for posting here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hmm, it could be that the token is expired or incorrect. Could you make sure you've requested the right scope(s):&amp;nbsp;&lt;EM&gt;user-modify-playback-state&lt;/EM&gt;? Also, could you double-check if you've added the users to your application in your &lt;A href="https://developer.spotify.com/dashboard/applications" target="_blank"&gt;Spotify for Developers dashboard&lt;/A&gt;? Let me know how you get on!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;/P&gt;&lt;P&gt;Hubo&lt;/P&gt;</description>
      <pubDate>Sun, 19 Dec 2021 20:54:55 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Start-Resume-Playback-API-return-401/m-p/5317677#M3810</guid>
      <dc:creator>Hubo</dc:creator>
      <dc:date>2021-12-19T20:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Resume Playback API return 401</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Start-Resume-Playback-API-return-401/m-p/5317874#M3820</link>
      <description>Hello Hubo, thank you for your reply.&lt;BR /&gt;&lt;BR /&gt;The scope that I'm requesting are:&lt;BR /&gt;1. streaming&lt;BR /&gt;2. user-read-email&lt;BR /&gt;3. user-read-private&lt;BR /&gt;4. user-read-playback-state&lt;BR /&gt;5. user-modify-playback-state&lt;BR /&gt;6. user-read-currently-playing&lt;BR /&gt;&lt;BR /&gt;I'm also added my own Spotify account into Spotify for Developers dashboard.&lt;BR /&gt;&lt;BR /&gt;About the token, I was able to use the token to request a get to the search API '&lt;A href="https://api.spotify.com/v1/search" target="_blank"&gt;https://api.spotify.com/v1/search&lt;/A&gt;', before and after the PUT &lt;A href="https://api.spotify.com/v1/me/player/play" target="_blank"&gt;https://api.spotify.com/v1/me/player/play&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;If the token had expired or incorrect during the PUT &lt;A href="https://api.spotify.com/v1/me/player/play" target="_blank"&gt;https://api.spotify.com/v1/me/player/play&lt;/A&gt; request, I should not be able to request a GET &lt;A href="https://api.spotify.com/v1/search" target="_blank"&gt;https://api.spotify.com/v1/search&lt;/A&gt;. But I did get a 200 status code from GET &lt;A href="https://api.spotify.com/v1/search" target="_blank"&gt;https://api.spotify.com/v1/search&lt;/A&gt; request.&lt;BR /&gt;&lt;BR /&gt;I'm still cannot get a 200 status code from PUT &lt;A href="https://api.spotify.com/v1/me/player/play" target="_blank"&gt;https://api.spotify.com/v1/me/player/play&lt;/A&gt; request. Feedback from the request still 401 'No token provided'.&lt;BR /&gt;&lt;BR /&gt;Appreciate your help, Hubo&lt;BR /&gt;Thank you&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Dec 2021 10:14:01 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Start-Resume-Playback-API-return-401/m-p/5317874#M3820</guid>
      <dc:creator>zhenyang</dc:creator>
      <dc:date>2021-12-20T10:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Resume Playback API return 401</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Start-Resume-Playback-API-return-401/m-p/5319590#M3836</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had figured out the problem. There is a mistake with the Axios PUT call.&lt;/P&gt;&lt;P&gt;This is the correct way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const response = await axios.put(`https://api.spotify.com/v1/me/player/play?device_id=${player_id}`,
            {
                "context_uri": selectedTrack.album.uri,
                "offset": {
                    "position": selectedTrack.track_number
                },
                "position_ms": 0
            },
            {
                headers: {
                    Accept: 'application/json',
                    Authorization: 'Bearer ' + props.token,
                    'Content-Type': 'application/json'
                }
            })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Dec 2021 10:45:41 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Start-Resume-Playback-API-return-401/m-p/5319590#M3836</guid>
      <dc:creator>zhenyang</dc:creator>
      <dc:date>2021-12-24T10:45:41Z</dc:date>
    </item>
  </channel>
</rss>

