我正在尝试像这样访问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”标头。因此,不允许访问来源“ http://www.bancadigital.com.br ”。
有人知道我可以使用该服务吗?
相关分类