cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
491
Views
0
Helpful
2
Replies

Cisco Finesse javascript API and user authentication

ajdmbs
Level 1
Level 1

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?

2 Replies 2

dekwan
Cisco Employee
Cisco Employee

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

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