var customXMLHttpRequest = (function (jwtoken) {
function getXMLHttpRequest(method, url, async){
var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.open(method, url, async);
xmlHttpRequest.setRequestHeader('Authorization', 'Bearer ' + jwtoken);
return xmlHttpRequest;
}
return getXMLHttpRequest;
})('Your token');