Avaya Client SDK

< Back to Package Overview

Tutorials

Auth Tutorial

Here is a simple example demonstrating how to retrieve the Breeze SSO Token from the UAC set cookie, and how to use that Token to configure the Customer Interaction Service Package.

//Authentication will be carried out by Breeze Auth Service - by redirect to a remote login page
//Auth token will then be set by UAC as a cookie
var SSOCookie = $cookies.get('UACCookieSession');
var authToken = { header: 'Authorization', value: SSOCookie };

//CIS Package Config
var config = {
    uacConfiguration: new AvayaCustomerServices.Config.UACConfiguration({
        enabled: true,
        clientInfo: {
            id: 'sampleApp'
        },
        serverInfo: {
            apiUrl: 'https://BREEZE-FQDN/services/UnifiedAgentController/UACAPI'
        },
        notificationInfo: {
            broadcastUrl: 'https://BREEZE-FQDN/services/Broadcast-UnifiedAgentController/broadcast',
            fallbackTransport: 'websocket'
        },  
        authenticationInfo: { 
            enabled: true, 
            tokens: ['Authorization'] 
            //this is a list of Token types (header type) that the package will use
            // i.e. in this case 'Authorization' token
        }
    })
};


function startCIS() {
    var client = new AvayaCustomerServices(config);
    var clientSession = client.createClientSession();

    // Set token to SDK token store
    clientSession.setToken(authToken);

    var agent = clientSession.createAgent();
    var work = clientSession.createWork();

    var interactions = work.getInteractions();
    var workRequests = work.getWorkRequests();

    //now either setup eventListeners or databinding
    ...
}