From A Web Browser

https://col-api.azurewebsites.net/v4/...

Sample:

https://col-api.azurewebsites.net/v4/projects

Using curl

curl -u {user}/{token} https://col-api.azurewebsites.net/v4/...

Sample:

curl -u bob@example.com/{UserToken}6qS12cMRHwHaXjp01oOjZBZLoSCfQxWBL7Tz5PIz https://col-api.azurewebsites.net/v4/projects

With HTTP authentication, the slash character in {user}/{token} must be URL-encoded as %2F.

Using jQuery

function GetProjects() {
    jQuery.support.cors = true;
    $.ajax({
        beforeSend: function (request) {
            var restAuthHeader = btoa($('UserName').val() + ':' + $('UserToken').val());
            request.withCredentials = true;
            request.setRequestHeader("Authorization", "Basic " + restAuthHeader);
        },
        url: 'https://col-api.azurewebsites.net/v4/projects',
        type: 'GET',
        dataType: 'json',
        success: function (data) {
            // Do something with the data.
        },
         error: function (jqXHR, textStatus, errorThrown) {
            // Do something with the error.
        }
    });
}

Sample:

function GetProjects() {
    jQuery.support.cors = true;
    $.ajax({
        beforeSend: function (request) {
            var restAuthHeader = btoa($('bob@example.com').val() + ':' + $('{UserToken}6qS12cMRHwHaXjp01oOjZBZLoSCfQxWBL7Tz5PIz').val());
            request.withCredentials = true;
            request.setRequestHeader("Authorization", "Basic " + restAuthHeader);
        },
        url: 'https://col-api.azurewebsites.net/v4/projects',
        type: 'GET',
        dataType: 'json',
        success: function (data) {
            DisplayProjects(data);
        },
         error: function (jqXHR, textStatus, errorThrown) {
            $('#error').html('<p>status code: ' + jqXHR.status + '</p><p>errorThrown: ' + errorThrown + '</p>').show();
            console.log('textStatus:');
            console.log(textStatus);
            console.log('errorThrown:');
            console.log(errorThrown);
        }
    });
}