vendredi 11 septembre 2015

Tickspot API: Get token using jQuery ajax

I'm testing the API V2 of tickspot http://ift.tt/1K2gIFM but I'm having some troubles trying to get the token.

$.ajax({
    url: 'http://ift.tt/1O5MB41',
    type: 'GET',
    //jsonp: "callback",
    dataType: 'jsonp',
    crossDomain: true,
    beforeSend: function(xhr) {
        xhr.withCredentials = true;
        xhr.setRequestHeader ("Authorization", "Basic " + btoa(username+":"+password));
        xhr.setRequestHeader('UserAgent','Project (email@company.com)');
    }
})
.done(function(response) {
    callback(response);
})
.fail(function(response) {
    callback(response);
})
.always(function() {
    console.log("complete");
});

I have tried with https and http but I always receive 401 Unauthorized and my credentials are correct.

Hope you can help me.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire