使用这些信息
https://developer.spotify.com/web-api/authorization-guide
我正在尝试实施“客户端凭据流”来自动化身份验证过程。但不知何故,我得到了下面的错误。
XMLHttpRequest 无法加载https://accounts.spotify.com/api/token?grant_type=client_credentials。请求的资源上不存在“Access-Control-Allow-Origin”标头。因此,Origin 'websiteURL' 不允许访问。
$http.get('https://accounts.spotify.com/api/token?grant_type=client_credentials', {
headers: {
'Authorization': 'Basic ' + key)
}
}).success(function(r) {
console.log('got access token', r);
}).error(function(err) {
console.log('failed to get access token', err);
});
我也通过 Ajax / Jquery 和其他方法尝试过,但仍然有这个“访问控制允许来源”。
我已经阅读了很多关于 CORS、Angular、Node 等的资料。老实说,我很困惑我应该使用其中的哪一个,而且我不知道如何使用。有人可以帮我简化一下吗?