title: problem playing songs via the spotify web api and javascript
body: <p>I am working on building a web-based application that interfaces with spotify.  I started with C# and had no problem accessing the API, pulling my playlist and pulling tracks off of it but it seems you cannot play songs with the spotify Web API located here:</p>
  
  <p><a href="https://developer.spotify.com/documentation/web-api/" rel="nofollow noreferrer">https://developer.spotify.com/documentation/web-api/</a></p>
  
  <p>I then started looking at the Web Playback API located here:</p>
  
  <p><a href="https://developer.spotify.com/documentation/web-playback-sdk/" rel="nofollow noreferrer">https://developer.spotify.com/documentation/web-playback-sdk/</a></p>
  
  <p>I intend to write most of it in c# because my c# is much stronger than my javascript.  The c# piece is working.  I can get an authorization token, pull my playlists and tracks.  I intend to pass this information to the javascript.</p>
  
  <p>I pulled the below javascript from the spotify developer page.  I only kindof understand it so I don't know why it isn't working.  Any help you can provide is greatly appreciated.</p>
  
  <pre><code>&lt;script src="https://sdk.scdn.co/spotify-player.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;
  
  window.onSpotifyWebPlaybackSDKReady = () =&gt; {
    // You can now initialize Spotify.Player and use the SDK
  };
  
  const play = ({
    spotify_uri,
    playerInstance: {
      _options: {
        getOAuthToken,
        id
      }
    }
  }) =&gt; {
    getOAuthToken(access_token =&gt; {
      fetch('https://api.spotify.com/v1/me/player/play', {
        method: 'PUT',
        body: JSON.stringify({ uris: [spotify_uri] }),
        headers: {
          'Content-Type': 'application/json',
          'Authorization': 'Bearer ${myaccesstoken}'
        },
      });
    });
  };
  
  play({
    playerInstance: new Spotify.Player({ name: "..." }),
    spotify_uri: 'spotify:track:7xGfFoTpQ2E7fRF5lN10tr',
  });
  
  &lt;/script&gt;
  </code></pre>