jeudi 4 janvier 2018

spotify application requests authorization

I am trying to get 'access token' from spotify with the following code.

    var encoded = btoa(client_id+':'+client_secret);
    function myOnClick() {
       console.log('clikced!');
       $.ajax({
       url: 'http://ift.tt/UPdH6I',
       type: 'POST',
       data: {
            grant_type : "client_credentials",
           'Content-Type' : 'application/x-www-form-urlencoded'
       },
       headers: {
           Authorization: 'Basic ' + encoded
       },
       dataType: 'json'
       }).always((data)=> console.log(data));
       }

however I keep getting errors:

    Cross-Origin Request Blocked: The Same Origin Policy disallows reading
    the remote resource at http://ift.tt/UPdH6I.
    (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

and readyState: 0, status: 0




Aucun commentaire:

Enregistrer un commentaire