CORS Warning: Create user without credentials (JS)

Hi,

I am currently receiving an issue with CORS warning appearing. I am attempting to create a user without credentials using the example code gather from postman. Although it works within postman it does not work with the application itself.

I run the following code below.

var settings = {
“async”: true,
“crossDomain”: true,
“url”: “https://dev-447740.oktapreview.com/api/v1/users?activate=true”,
“method”: “POST”,
“headers”: {
“Accept”: “application/json”,
“Content-Type”: “application/json”,
“Authorization”: “SSWS 00H7Kh1dMPOiwblhqtKkDzZVqHi-TmEpPTzzHo9DB1”,
“cache-control”: “no-cache”,
“Postman-Token”: “90268a46-9102-427e-b896-641eb1e4fad4”
},
“processData”: false,
“data”: “{\n "profile": {\n \t"accountNo": "1",\n "firstName": "Isaac",\n "lastName": "Brock",\n "email": "isaac3@example.com",\n "login": "isaac3@example.com",\n "secondEmail": "abroadhurst@distology.com"\n }\n}”
}

$.ajax(settings).done(function (response) {
console.log(response);
});

The expect error I should have got (printed into the console) was “login: An object with this field already exists in the current organization”;

However the console spits back an error from CORS.

Please ask any questions below if you need more information.

I found the solution. This was due to my trusted origin having ‘https://’ instead of ‘http://’ and an incorrect path to the jquery plugin.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.