10-11-2022 01:15 PM
when I submit a POST request like so:
var logData = '<ClientLog><logData>This is some logged data for the log file 20221011_1</logData></ClientLog>';
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log("Gadget is now refreshing MB NEW" + this.responseText);
}
});
xhr.open("POST", https://finesse1.xyz.com/finesse/api/User/660008/ClientLog);
xhr.setRequestHeader("Content-Type", "application/xml");
xhr.send(logData);
I get a response
<ApiErrors>
<ApiError>
<ErrorType>Invalid Authorization User Specified</ErrorType>
<ErrorData>660008</ErrorData>
<ErrorMessage>The user specified in the authentication credentials and the uri don't match</ErrorMessage>
</ApiError>
</ApiErrors>
But if I switch out my ID 660008 for finadmin (https://finesse1.xyz.com/finesse/api/User/finadmin/ClientLog), the api works and I get a 200 and write a line to the logs
and this is for the ClientLog endpoint https://developer.cisco.com/docs/finesse/#!clientlog%e2%80%94post-to-finesse/clientlogpost-to-finesse
Why am I getting this error?
Solved! Go to Solution.
12-12-2022 11:13 AM
This answer in Webex chat DevNet Dev Support Questions helped resolve this:
If that user is SSO enabled, you need to get the bearer token rather than basic auth with username/password.
Such as:
xhr.setRequestHeader("Authorization", "Bearer eyJjdHk*****i");
11-04-2022 01:19 PM
Hello @matthew.bavosa ,
Restarting Finesse may help. Please read this discussion for more details:
I know you're logging in with User ID and not Name, but it might be worth a shot. I hope this helps!
11-08-2022 03:54 AM - edited 11-08-2022 04:06 AM
It looks like you are trying to POST the client logs for the user with user ID 660008(https://finesse1.xyz.com/finesse/api/User/660008/ClientLog) using some other user's (possibly the administrator) credentials.
You should be using the credential of the same user that is in the URL as the error suggests.
Example:
var logData = '<ClientLog><logData>This is some logged data for the log file 20221011_1</logData></ClientLog>';
var agent = '660008';
// Fill the password
var pwd = 'password-for-agent-660008';
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log("Gadget is now refreshing MB NEW" + this.responseText);
}
});
xhr.open("POST", 'https://finesse25.autobot.cvp:8445/finesse/api/User/' + agent + '/ClientLog');
xhr.setRequestHeader("Content-Type", "application/xml");
xhr.setRequestHeader("Authorization", "Basic " + btoa(agent + ":" + pwd));
xhr.send(logData);
Regards,
Renjith
12-12-2022 11:13 AM
This answer in Webex chat DevNet Dev Support Questions helped resolve this:
If that user is SSO enabled, you need to get the bearer token rather than basic auth with username/password.
Such as:
xhr.setRequestHeader("Authorization", "Bearer eyJjdHk*****i");
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide