RestAPI get pending task ajax

1
0
-1

Hi,
I use ajax to get list of pending tasks for loged in user, but i get 401 error I also send my x-bonita-api-token and JSESSIONID via hard code, and don't know how to make it dynamic.Also I am pretty sure my token and ID is update.
here is my get request :
$.ajax({
type:'GET',
dataType: 'jsonp',
headers: {
// 'Access-Control-Allow-Origin': '*',
'JSESSIONID' : '5618D77A0D13CC598FD632A24AD376A9',
'X-Bonita-API-Token' : 'e730cac4-ae1d-4465-ad15-1907c471cae5'
},
url: 'http://MYURL/bonita/API/bpm/humanTask'
});
and
my authentication code is here:
var params = {
'username': 'username',
'password': 'password',
'redirect': 'false'
};

    var formData = new FormData();

    for (var k in params) {
        formData.append(k, params[k]);
    }

    var request = {
        method: 'POST',
          mode: 'no-cors',
        body: formData
    };
    var us = "io";
    fetch('http://MY URL/bonita/loginservice', request);
    var request1 = {
        method: 'POST',
        mode: 'no-cors'
    };

.

No answers yet.
Notifications