on 01-12-2022 11:59 PM
I am creating a Fiori App calling the API for the Authentication Service. I did a trial in the SAP Business Hub and the GET and DELETE Requests are working (200 OK).
However, i followed this tutorial to create a firori app. i copied the snippet code of the GET request as explained in step two and removed xhr.setRequestHeader("DataServiceVersion", "2.0"
from the onInit
function to unlock the CORS policy.
Unfortunately i get the CORS Missing Allow Origin
https://developers.sap.com/tutorials/productconfiguration-ui5-app-create.html
onInit: function () {
var data = JSON.stringify();
var password = " ** ";
var userName = " ** ";
var credentials = userName + ":" + password;
var hash = btoa(credentials);
var auth = "Basic" + hash;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
//setting request method //API endpoint for API sandbox
xhr.open("GET", "https:// ** .accounts.ondemand.com/scim/Users");
//adding request headers
xhr.setRequestHeader("config_authType", "Basic");
xhr.setRequestHeader("Authorization", auth);
xhr.setRequestHeader("config_packageName", "SCPIdentityServices");
xhr.setRequestHeader("config_actualUrl", "https:// ** .accounts.ondemand.com/scim");
xhr.setRequestHeader("config_urlPattern", "https://{tenant}.{host}/scim");
xhr.setRequestHeader("config_apiName", "IdDS_SCIM");
//xhr.setRequestHeader("DataServiceVersion", "2.0");
xhr.setRequestHeader("Accept", "*/*");
xhr.setRequestHeader("APIKey", " ** ");
//sending request
xhr.send(data);
}
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.