I have to develop a sapui5 application with the sap web ide: the user must be enabled to perform CRUD operations on the SAP Cloud Platform Identity Authentication (URL: "https: // . accounts.ondemand.com / service / scim / Users ") via app and manage users. First I tested it on Postman successfully. Later I tried to make an AJAX call (directly on the controller.js) to get a json with all the users already registered on the SAP Identity Authentication. This is the code:
var username = "T000034";
var password = "012345";
var url = "https:// . accounts.ondemand.com/service/scim/Users";
$.ajax({
url: url,
async: true,
type:'GET',
dataType: 'json',
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Basic "+btoa(username+':'+password));
},
success: function(json){ console.log(json); },
error: function(err) { console.log(err); } });
In the console after several attempts I get the following error:
"Failed to load resource: the server responded with a status of 401 (Unauthorized) extension_runnable_file.html? hc_orionpath =% 2Fs0*********03trial% 24s0*********03-OrionContent% 2Faaaaaa & origional-url = index.html & sap-ui-appCacheBuster = ..% 2F & sap-ui-xx-componentPreload = off: 1 Failed to load https: // . accounts.ondemand.com / service / scim / Users:
Response for preflight has invalid HTTP status code 401. "
What's wrong? Any suggestions?