ok.. so turns out, changing the way to call the api from UI needed a different approach (not sure why)... right now only additional setting in the splunk server I have is
[sslConfig]
enableSplunkdSSL = false
.
.
.
[httpServer]
crossOriginSharingPolicy = *
and ui code is now using async method to fetch the token:
getToken = async() => {
var details = {
'username': 'admin',
'password': 'J17kP3xjyBSvvKSuR5HrEYSI8w4'
};
var formBody = [];
for (var property in details) {
var encodedKey = encodeURIComponent(property);
var encodedValue = encodeURIComponent(details[property]);
formBody.push(encodedKey + "=" + encodedValue);
}
formBody = formBody.join("&");
console.log(formBody)
const response = await fetch("http://splunk.local:8089/services/auth/login?output_mode=json", {
method: "POST",
body: formBody,
headers: {
'Content-type': 'application/x-www-form-urlencoded'
}
});
const responseInJson = await response.json();
console.log(`Session Key - ${responseInJson.sessionKey}`);
return responseInJson.sessionKey
}
And it somehow now seems to work!
The same server settings do not work with the earlier UI code but work with async somehow!
... View more