Author Message
DanielStingl
Joined: Nov 20, 2013
Messages: 41
Offline
Hi all,

we are using the JavaScript Client SDK (Version 4.12.0) and have trouble to connect to the AADS (Avaya Aura Device Services).
During startup the sdk connects to AAWG and AADS and authenticates the user.
But suddenly there appears a browser prompt to enter username and password for AADS-Server.

Here is the code we use to connect and authenticate to the services:


let username = "dev.test1@OURDOMAIN.de"
let password = "well_the_password"

var userConfig = new AvayaClientServices.Config.UserConfiguration();
let callCredentialProv = new AvayaClientServices.Config.CredentialProvider(username, password);
callCredentialProv.addOnInvalidCredentialsCallback(function (ev) {
console.log("Login Invalid " + JSON.stringify(ev));
});
userConfig.sgConfiguration.enabled = true;
userConfig.sgConfiguration.networkProviderConfiguration = createNetworkProviderConfig(AppConfig.WebgatewayConfig);
userConfig.sgConfiguration.credentialProvider = callCredentialProv;

userConfig.callUserConfiguration.incomingCall = true;

const acsCredentialProvider = new AvayaClientServices.Config.CredentialProvider(username, password);
acsCredentialProvider.addOnInvalidCredentialsCallback(function (ev) {
console.log("Login Invalid " + JSON.stringify(ev));
});

const acsConfiguration = userConfig.acsConfiguration;
acsConfiguration.enabled = true;
acsConfiguration.credentialProvider = acsCredentialProvider;
acsConfiguration.networkProviderConfiguration = createNetworkProviderConfig(AppConfig.ACSConfig);

let softphoneUser = SoftphoneClient.createUser(userConfig);
softphoneUser.start()


The connection and authentication to AAWG (Calls Service) works fine (http and websocket) but the connection to AADS appears to be strange.
See the browser console log:

AvayaClientServices.min.js:1 [2/1/2021, 10:05:42 AM] UserService: API called: AvayaClientServices.createUser
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] UserService: API called: User.start
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] UserService: Starting SDK, version is 4.6.0.69
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] UserService: Browser detected as chrome
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] UserService: User agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36 Edg/88.0.705.56
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] ContactsService: Starting the service
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] UserService: Starting 4 services.
aads.OURDOMAIN.de/acs/resources:1 Failed to load resource: the server responded with a status of 406 (Not Acceptable)
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] NetworkProvider: ACSContactsProvider,Network error occurred. Status: 406
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] ContactsService: Service is unavailable
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] ACSContactsProvider: Request failed undefined
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] CallProvider: Calls Service Activated: tkwebgw.OURDOMAIN.local:443
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] CallProvider: Received Network Availability: tkwebgw.OURDOMAIN.local:443
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] VoiceMessagingService: Starting the service
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] VoiceMessagingService: Service started successfully
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] VoiceMessagingService: Service is available
AvayaClientServices.min.js:1 [2/1/2021, 10:05:44 AM] VoiceMessagingService: New voicemail number is null
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] CSGPresenceAndCallProvider: Ignoring telephony notification: [Id:undefined,Type:featureStatusChanged]
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] CSGPresenceAndCallProvider: Ignoring telephony notification: [Id:undefined,Type:featureStatusChanged]
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] CSGPresenceAndCallProvider: Ignoring telephony notification: [Id:undefined,Type:featureStatusChanged]

AvayaClientServices.min.js:1 WebSocket connection to 'wss://aads.OURDOMAIN.de/notification/bsid/125131b8-8661-4c8e-a213-139c18e69bc8/notificationChannel/websocket' failed: HTTP Authentication failed; no valid credentials available

AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ACSContactsProvider: Notification provider connection failed Event
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ContactsService: Service is unavailable
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ACSContactsProvider: Start notification channel failed.
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ACSContactsProvider: Failed to start notification provider e
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ContactsService: Service is unavailable
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ACSContactsProvider: Auth session refreshing is not active
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ACSContactsProvider: Notification session refreshing is not active
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ACSContactsProvider: Failed to start ACSNetworkProvider e
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ContactsService: Failed to start service e
AvayaClientServices.min.js:1 WebSocket connection to 'wss://aads.OURDOMAIN.de/notification/bsid/a28d2d21-9cbc-44fb-83ef-b6f03b74e0ca/notificationChannel/websocket' failed: HTTP Authentication failed; no valid credentials available
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ACSContactsProvider: Notification provider connection failed Event
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ACSContactsProvider: Start notification channel failed.
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ACSContactsProvider: Auth session refreshing is not active
AvayaClientServices.min.js:1 [2/1/2021, 10:05:45 AM] ACSContactsProvider: Notification session refreshing is not active
-----> [here the browser shows the login prompt]
AvayaClientServices.min.js:1 [2/1/2021, 10:05:48 AM] UserService: Resolving promise : [3,1]
AvayaClientServices.min.js:1 [2/1/2021, 10:06:06 AM] ACSContactsProvider: Auth session refreshing is already active
AvayaClientServices.min.js:1 [2/1/2021, 10:06:06 AM] ACSContactsProvider: Notification session refreshing is already active
AvayaClientServices.min.js:1 [2/1/2021, 10:06:07 AM] ContactsService: Service is available
AvayaClientServices.min.js:1 [2/1/2021, 10:06:07 AM] UserService: API called: User.getSelfContact
AvayaClientServices.min.js:1 [2/1/2021, 10:06:07 AM] ContactsService: Service started successfully


The js sdk says that the websocket connection to aads is not authenticated and the browser login prompt appears. If I enter the same credentials I will be authenticated and can work with the contacts-service of the sdk.

As I saw in the network log of chrome devtools, the sdk can successfully authenticate via http, then switches to websocket but without credentials.
Then it falls back to SSE which is also unauthenticated and then the browser shows the login prompt:
Request 1: HTTP OPTIONS - https://aads.OURDOMAIN.de/acs/resources
Response: HTTP Code 204

Request 2: HTTP GET - https://aads.OURDOMAIN.de/acs/resources
Response: HTTP Code 406 Not Acceptable

Request 3: Request 2: HTTP GET - https://aads.OURDOMAIN.de/acs/resources
Response: HTTP Code 200 OK

Request 4:
Websocket: wss://aads.OURDOMAIN.de/notification/bsid/b21781e5-8a92-48fd-b311-3d5bb2fb64a2/notificationChannel/websocket
Response: HTTP Authentication failed; no valid credentials available

Request 5: Request 2: HTTP GET - https://aads.OURDOMAIN.de/acs/resources
Response: HTTP Code 200 OK

Request 6:
https://aads.OURDOMAIN.de/notification/bsid/67c4810b-4244-44c7-ad69-39e2a64c1934/notificationChannel/sse
Browsers HTTP-Auth-Prompt appears


We have same behavior in the js sdk sample app.

Why doesn't the sdk automatically send the credentials to AADS via websocket and/or sse?
Is this a client sdk problem or could it be on server side?

Thanks
Daniel
Arturas012024
Joined: Dec 3, 2020
Messages: 1
Offline
Hello!

Could you please try to launch your application with disabled Chrome SameSite cookies option?
chrome://flags/#same-site-by-default-cookies
DanielStingl
Joined: Nov 20, 2013
Messages: 41
Offline
Hi Arturas,

with SameSite-option disabled the authentication works as expected.
So, I did some research to the behavior resulting in set the SameSite-attribute in AADS config.
https://documentation.avaya.com/de-DE/bundle/AdministeringAvayaDeviceServices_R8.0.3/page/Configuring_SameSite_cookies.html

Well, we currently have AADS 8.0.1, which doesn't support the SameSite-attribute. We will upgrade AADS and change the SameSite-attribute behavior.

Thanks for your hint which saved a lot of time.

Daniel
Go to:   
Mobile view