title: spotify api token response code 400
body: <p>I received successfully access code, by providing credentials after get request <a href="https://accounts.spotify.com/authorize" rel="nofollow">https://accounts.spotify.com/authorize</a>.  </p>
  
  <p>Now I am trying to receive access token by making POST request to <a href="https://accounts.spotify.com/api/token" rel="nofollow">https://accounts.spotify.com/api/token</a></p>
  
  <p>My java code looks like: </p>
  
  <pre><code>HttpClient client = HttpClientBuilder.create().build();
      URIBuilder url = new URIBuilder();
      url.setScheme("https").setHost("accounts.spotify.com").setPath("/api/token")
          .addParameter("code", Spotify.code)
          .addParameter("redirect_uri", "http://localhost:8888/callback")
          .addParameter("grant_type", "authorization_code");
      URI buildurl = url.build();
      HttpPost requset = new HttpPost(buildurl);
  
      String header = new String(client_id + ":" + client_secret);
      byte[] encoded = Base64.encodeBase64(header.getBytes());     
      header = new String(encoded);
      requset.setHeader("Authorization", "Basic " + header);
      HttpResponse response = client.execute(requset);
  </code></pre>
  
  <p>After executing request I receive response code 400. 
  I have validated request value and header, it looks good.  </p>
  
  <p>What am I doing wrong? I suppose response code 400 indicates that something is wrong in my request. </p>