小编Sev*_*Jr.的帖子

Spotify Auth + Angular +客户端凭据流

使用这些信息
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等的内容。老实说,我很困惑应该使用其中的哪些,但我不知道如何使用。有人可以为我简化一下吗?

spotify asp.net-web-api spotify-app

2
推荐指数
1
解决办法
2650
查看次数

标签 统计

asp.net-web-api ×1

spotify ×1

spotify-app ×1