使用这些信息
https://developer.spotify.com/web-api/authorization-guide
我正在尝试实施“客户端凭据流程”以自动进行身份验证过程。但是我莫名其妙地收到下面的错误。
XMLHttpRequest无法加载https://accounts.spotify.com/api/token?grant_type=client_credentials。所请求的资源上没有“ Access-Control-Allow-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);
});
Run Code Online (Sandbox Code Playgroud)
我也通过Ajax / Jquery和其他方法进行了尝试,但是仍然有一个“ Access-Control-Allow-Origin”。
我已经阅读了很多有关CORS,Angular,Node等的内容。老实说,我很困惑应该使用其中的哪些,但我不知道如何使用。有人可以为我简化一下吗?