Cordova


This plugin is native for Android and iOS. You can read the previous guide to implement the SDK in your project. You need to add extra code to your project native to implement the SDK.
Remember that you are free to change anything in the plugin, but you must keep the same structure.

To continue with the implementation of the SDK, you must have The Cordova CLI installed. If you don't have it installed, you can install it with the following command:

npm install -g cordova

Quick start


Our team has created a simple plugin available for Android e iOS to facilitate the implementation of the SDK in your project. Request access to the plugin by sending an email to [email protected].

Once you have access to the plugin, you can install it with the following command:

cordova plugin add ../AKCordovaPlugin --link

Set up


1. JS/TS Configuration

The plugin has following input parameters for default:

file.js
let json = {
    "config": {
        "signature": "xxxx",
        "clientId": "xxxx",
        "clientPassword": "xxxx",
    },
    "flowId": "xxxx",
    "country": "xxxx",
    "docType": "xxxx",
    "idNum": "xxxx"
}
ParameterDescription
signatureSignature of the application.
clientIdClient Id of the application.
clientPasswordClient password of the application.
flowIdFlow Id of the account.
countryCountry of the user.
docTypeDocument type of the user.
idNumDocument number of the user.

To call the plugin you have to add the following code in your file:

file.js

cordova.exec(success, error, "AKCordovaPlugin", "autentikar", [json]);

2. Android Configuration

To android configuration you mush the following previous guide Android.

The plugin for default implement the com.autentikar:core:4.2.0 and com.google.code.gson:gson:2.9.1 dependencies.

You must secure that AndroidManifest.xml file has reference to the AKCordovaActivity activity, also application property has android:theme.

AndroidManifest.xml

<activity android:name="com.autentikar.plugin.ak.AKCordovaActivity" />

3. iOS Configuration

To iOS configuration you mush the following previous guide iOS.

The plugin are implemented in Swift and Objective-C languages.

Modify the AKCordovaPlugin.swift and AKCordovaPlugin.m class with your own code.

Response

For obtain the result of the SDK in your JS/TS code you have to add the following code in your file:

file.js
function success(result) {
    let json = JSON.parse(result)
    console.log(json);
}

function error(error) {
    console.log(error);
}