我正在尝试像这样访问 Spotify API 令牌:
$.ajax({
url: "https://accounts.spotify.com/api/token",
type: 'POST',
contentType: "application/json; charset=\"utf-8\"",
crossDomain: true,
data: {
grant_type: "authorization_code",
code: code,
redirect_uri: "http://www.bancadigital.com.br/spotifyteste/callback.html"
},
processData: false,
dataType: "json",
headers: {
Authorization: "Basic " + utf8_to_b64(key)
},
success: function( response ) {
alert(response.access_token);
},
});
但服务返回以下错误:
XMLHttpRequest 无法加载https://accounts.spotify.com/api/token。请求的资源上不存在“Access-Control-Allow-Origin”标头。Origin ' http://www.bancadigital.com.br ' 因此不允许访问。
有谁知道我如何访问该服务?