Spotify Web Api 令牌请求响应 400

Spotify Web Api Token Request Response 400

现在我正在尝试通过 Spotify Web Api 中的授权代码流方法将我的授权代码交换为令牌,但作为响应,我总是得到 400 状态。这是我正在使用的代码:

HttpPost httppost = new HttpPost(new URI("https://accounts.spotify.com/api/token/?grant_type=authorization_code&code=" + tempCode + "&redirect_uri=" + RedirectUri));
    httppost.addHeader("Authorization",  "Basic " + Base64.encodeBase64String((ClientId + ":" + ClientSecret).getBytes()));
    httppost.setProtocolVersion(HttpVersion.HTTP_1_1);

谢谢你帮助我!

删除令牌后的斜线

应该是https://accounts.spotify.com/api/token

此外,请求参数应该在 POST 主体中,而不是在 URI 中。