Author Message
KoenTielens2
Joined: Jun 14, 2006
Messages: 14
Offline
Hello,

UACConfiguration has AuthenticationInfo is used in the code examples in the following way:

authenticationInfo: { enabled: true, tokens: ['Authorization'] }

The only thing I can relate "Authorization" to is a header that should end up in the request towards the server ...

The documentation says:

tokens :Array.<string>

List of tokens to use. Used by the token provider when attempting to fetch tokens from the token collection.
Type: Array.<string>

Point is: In the code, no tokes are present so how do we need to understand this? Does the tokes array needs to have a pointer to headers that carry the Token(s)?

Kind regards, Koen
SDK_CIS_Package
Joined: Dec 15, 2016
Messages: 22
Offline
Hi Koen,

The authenticationInfo.tokens property accepts an array of strings which act as a whitelist. By setting
authenticationInfo: { enabled: true, tokens: ['Authorization'] }

you are instructing the token provider to search through a collection of tokens and apply it to the header when making a request. This token must be added to the token collection using
clientSession.setToken({header: 'Authorization', value: token});

before a request requiring the header to be set can be made.

For example...


const authToken = {header: 'Authorization', value: token};

// UAC Configuration for Avaya Customer Services SDK
const config = {
uacConfiguration: new AvayaCustomerServices.Config.UACConfiguration({
...
authenticationInfo: {enabled: true, tokens: ['Authorization']}
...
})
};

// Initialize the Avaya Customer Services SDK
const client = new AvayaCustomerServices(config);

// Start Client Session service
const clientSession = client.createClientSession();

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

// Handle callback when configuration is loaded from UAC
clientSession.getConfiguration(authHandle).then((configuration) => {......}


Regards,
CIS Support Team
KoenTielens2
Joined: Jun 14, 2006
Messages: 14
Offline
Resolved!
Go to:   
Mobile view