Dear Experts,
I have developed an SAPUI5 app and I am trying to fetch data from SAP using the SICF service which returns JSON format. I am not using and OData services.
When I am trying to authenticate this service using JSONModel I am getting unauthorized error. I am passing the right credentials but still facing the same issue.
Sample Code....
var userName = "USERNAME";
var password = "PASSWORD";
var credentials = userName + ':' + password;
var hash = btoa(credentials);
var auth = 'Basic '+hash;
var header = {
'Authorization':auth,
'Access-Control-Allow-Origin':'*',
'Content-Type':'application/json'
}
var customerModel = new sap.ui.model.json.JSONModel();
customerModel.loadData("http://hostname:port/ui5?&mobile=123456789",null,true,'GET',false,false,header);
I am getting below error....
Response for preflight has invalid HTTP status code 401
Kindly help...!
Thanks
Ravi