Handle Authentication States And Errors
In this tutorial it will be shown how to track authentication state changes as well as authentication errors. Event
handlers for following events must be set:
function onAuthenticationStateChanged(authenticationState)
{
switch(authenticationState)
{
case "NotAuthenticated":
// Handle authentication state here...
break;
case "InProgress":
// Handle authentication state here...
break;
case "Authenticated":
// Handle authentication state here...
break;
}
}
function onAuthenticationError(authenticationError)
{
switch(authenticationError)
{
case "InvalidConfig":
// Handle authentication error here...
break;
case "InvalidCredentials":
// Handle authentication error here...
break;
case "InvalidToken":
// Handle authentication error here...
break;
case "ServerCertificateRejected":
// Handle authentication error here...
break;
case "ClientCertificateError":
// Handle authentication error here...
break;
case "NoCredentialsConfigured":
// Handle authentication error here...
break;
case "CouldNotConnect":
// Handle authentication error here...
break;
case "Failed":
// Handle authentication error here...
break;
case "SSLConnectError":
// Handle authentication error here...
break;
case "Unknown":
// Handle authentication error here...
break;
}
}
cwic.LoginController.addEventHandler('onAuthenticationStateChanged', onAuthenticationStateChanged);
cwic.LoginController.addEventHandler('onAuthenticationError', onAuthenticationError);
See AuthenticationState and AuthenticationError for more info.