Skip to main content

Login

If you receive a StartResultEvent with LOGIN_REQUIRED as the sdkState, you must perform a login with the userIdentifier received in this event. Note that unlike KOBIL Digitanium and KOBIL Digitanium+ installations, multiple users are not supported.

In the KOBIL Shift Lite environment, you can choose between several authentication modes during login. When the login attempt returns with an error such as NO_TOKEN_DATA_AVAILABLE, TOKEN_DATA_IS_OUTDATED, or CANNOT_ACQUIRE_TOKEN_DATA, you need to open the KOBIL Shift Lite system's login page and proceed as detailed in the Activation section.

Login Event Flow Diagram for KOBIL Shift Lite

The following event flow diagram details the process flow for this login procedure:

Stay Logged In

An activated user can stay logged in for a predefined duration if they have a valid session on the IDP and valid tokens stored in MC. To learn more, read Stay Logged In.

Login/Subsequent Login Without Offline Token

For login or subsequent login without a valid OfflineToken, you need to open your IAM login page with the following headers:

  • X-KOBIL-ASTCLIENTID: $clientId
  • X-KOBIL-ASTCLIENTDATA: $astClientData

After entering your credentials on the IAM login page, you will receive a URL from the web view that contains the authorization code. You need to parse the authorization code from the URL and provide it to the Master Controller SDK via SetAuthorizationCodeEvent. The MC will use the authorization code to exchange it for an IAM token. Upon successful key exchange, you will receive a status OK.

Refer to IAM Activation for the extraction of the authorization code from the response URL (see parseUrl() method).

Implementation Example

SetAuthorizationCodeEvent (Kotlin)
// Set authorization code
fun setAuthorizationCode(userId: String, tenantId: String, authCode: String, clientId: String) {
val authMode = if (SessionManager.getInstance(context).useBiometry()) {
AuthenticationMode.BIOMETRIC
} else {
AuthenticationMode.NO
}

val setAuthCodeEvent = SetAuthorisationCodeEvent(
UserIdentifier(tenantId, userId),
authMode,
authCode,
clientId
)

synchronousEventHandler?.postEvent(setAuthCodeEvent)?.then {
logDebug("received SetAuthorisationCodeResultEvent: $it", "setAuthorisationCode")
// handle result. StatusType.OK would mean the user is now logged in.
}
}