04-06-2023 09:10 AM
I am trying to use the Cisco Finesse javascript library (the REST API wrapper) to retrieve user information. According to the documenation at https://developer.cisco.com/docs/finesse/#!rest-services-javascript-library/javascript-library I can create a user object as in the following example code from the documenation:
var _user = new finesse.restservices.User({ id: '1001001', onLoad: function(user){ // Do something on the successful fetch(GET) of user object }, onChange: function(user){ // Do something on the successful update(PUT) of object // can do user.getState() or user.getTeamName() } onError: function(err){ // Something went wrong while fetching user data, show an error dialog to the user may be. } });
However, before making this call, don't I need to log in to the Finesse server using the user's username and password? How do I authenticate a user before I use the Finesse javascript library?
04-07-2023 09:50 AM
Hi,
The Finesse JavaScript library can only be used to build gadgets for the Finesse desktop. With that being said, the Finesse desktop already has the authentication credentials. In the initialization of the gadget, you have the line of code
var cfg = finesse.gadget.Config;
finesse.clientservices.ClientServices.init(cfg, false);
The cfg has the credentials. After this line of code, the authentication is automatically done for you.
Take a look at the LearningSampleGadget for a step by step guide on how to use the library: https://github.com/CiscoDevNet/finesse-sample-code/tree/master/LearningSampleGadget
Thanx,
Denise
04-07-2023 02:30 PM
Ok thank you Denise!
So if I want to access the Finesse Web API from javascript I need to make ajax calls and send the username and password in the headers. Is this correct?
Alfredo Diaz
Alfredo
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