Initialization of the IdpSdk
The IdpSdk initialization process involves setting up the necessary configurations and initializing the IdpSdkNativeInterface.
Dependency
Add the IdpSdk AAR to your build.gradle:
debugImplementation(
name = "idpsdk-debug", ext = "aar",
group = "com.kobil", version = "0.7.2973720"
)
releaseImplementation(
name = "idpsdk-release", ext = "aar",
group = "com.kobil", version = "0.7.2973720"
)
Prerequisites
Ensure you have the following available before initializing:
- tenantId: The identifier for your IDP tenant.
- idpUrl: The base URL of the IDP server.
- certificateChain: The trusted SSL certificate as a byte array, loaded from your assets.
Android/Kotlin
class IdpSdkApp : Application() {
companion object {
const val TENANT_ID = "your-tenant-id"
const val IDP_URL = "https://your-idp-server.example.com"
const val CERT_FILE = "your-certificate.crt"
}
override fun onCreate() {
super.onCreate()
val certificateChain = assets.open(CERT_FILE).use { it.readBytes() }
// initIdpSdk(tenantId, idpUrl, certificateChain, shouldHashPin)
IdpSdkNativeInterface.initIdpSdk(TENANT_ID, IDP_URL, certificateChain, false)
}
}
NOTE: The IdpSdk must be initialized via
initIdpSdkbefore calling any other IdpSdk method.
Master Controller Setup
The IdpSdk relies on the MC-SDK to exchange events with the server. Before using any IdpSdk flow you must:
- Set up a
SynchronousEventHandler— this is your communication channel with the Master Controller. See Communication with the MasterController for implementation details. - Trigger a
StartEvent— this initialises the MC-SDK session and returns aStartResultEventcontaining thesdkStatethat tells you whether activation or login is required. See Start/Restart Event for details.
NOTE: MC-SDK events such as
GetAstClientDataEventandSetAuthorisationCodeEventwill fail if aStartEventhas not been successfully completed first.
Authorization Flow
After both the IdpSdk and MC-SDK are initialised, all IdpSdk operations (activation, login, change PIN, forgot PIN) share the same three-step flow with the MC-SDK:
- Get AST client data — post a
GetAstClientDataEventto the MC-SDK and receive aGetAstClientDataResultEvent. Use the result to construct anAstClientDataInfoobject. - Get authorization code — call the relevant
IdpSdkNativeInterfacemethod (e.g.getAuthorizationCode). The SDK calls back yourIdpSdkInteractionInterface.provideCredentialsimplementation to collect user credentials. - Set authorization code — post a
SetAuthorisationCodeEventto the MC-SDK with the received authorization code (not required forchangePin/forgotPin).
See the individual flow pages for full implementation details: