XMLHttpRequest with the current user credentials

Andrew Pishchul
Giga Expert

Looking for options how to execute XMLHttpRequest with the current (logged in) user's credentials.

Very simple code (UI script), same domain/origin, but it doesn't work - every time it asks for credentials:

var data = JSON.stringify({

  "short_description": "Hello"

});

var xhr = new XMLHttpRequest();

xhr.withCredentials = true;

xhr.open("POST", "https://XXXX.service-now.com/api/now/table/incident");

xhr.setRequestHeader("content-type", "application/json");

xhr.setRequestHeader("Access-Control-Allow-Credentials","true");

xhr.send(data);

Any ideas? josh.nerius?

1 ACCEPTED SOLUTION

Andrew Pishchul
Giga Expert

Found the solution: X-UserToken


View solution in original post

1 REPLY 1

Andrew Pishchul
Giga Expert

Found the solution: X-UserToken