Basic Authentication

ARGOplay API uses Basic Authentication for versions up to (including) v2.9. Authentication Header should be send with each call to the API. So there is no any Login / Logout API calls.

Usage (working example is here):

getUser ();

function getUser () {
    var user = 'user';
    var password = 'test';
    var auth = "Basic " + btoa(user + ":" + password);

    var urlApi = 'https://api.bear2b.com/v2.9/users/me';

    $.ajax({
        processData: true,
        type: 'GET',
        url: urlApi,
        headers: {"Authorization": auth},
        success: function(data){
            var user = data;
            $('body').html('<code>'+JSON.stringify(user)+'</code>');
        },
        error: function(data){
            $('body').html( data.responseJSON.error + ' ' + data.responseJSON.description );
        }
    });

}

You can also set Authentication header for all ajax calls using this code snippet:

var user = 'user';
var password = 'test';
var auth = "Basic " + btoa(user + ":" + password);
$.ajaxSetup({ headers: {"Authorization": auth} });