Integrate the Incode Onboarding Cordova Plugin into your Cordova, Capacitor, or Ionic app. This guide covers prerequisites, installation, per-platform setup, and running your first onboarding flow.

## Contents

- [Prerequisites](https://developer.incode.com/docs/cordova-getting-started#prerequisites)
- [Installation](https://developer.incode.com/docs/cordova-getting-started#installation)
- [Android setup](https://developer.incode.com/docs/cordova-getting-started#android-setup)
- [iOS setup](https://developer.incode.com/docs/cordova-getting-started#ios-setup)
- [Initialize the SDK and run a flow](https://developer.incode.com/docs/cordova-getting-started#initialize-the-sdk-and-run-a-flow)
- [Sample app](https://developer.incode.com/docs/cordova-getting-started#sample-app)
- [Troubleshooting](https://developer.incode.com/docs/cordova-getting-started#troubleshooting)

## Prerequisites

| Tool | Version | Notes |
| --- | --- | --- |
| Node.js | 18+ | For the Cordova CLI and your app |
| Cordova CLI | 11+ | `npm install -g cordova` |
| Android Studio / SDK | API 21+, `compileSdk` 35, Java 11+ | For Android builds |
| Xcode | iOS 13+ target | For iOS builds (macOS only) |
| Incode API credentials | — | API key and base URL, provided by Incode |
| GitHub token | — | Personal access token with `read:packages`, for Incode's Android Maven repository |

## Installation

Install the **Incode Onboarding Cordova Plugin** from the npm package id:

```shell
cordova plugin add incode-cordova-plugin
```

…or directly from the release repository:

```shell
cordova plugin add https://github.com/Incode-Technologies-Example-Repos/CordovaPluginReleases.git
```

…or, for the **NFC** variant (NFC-capable hardware required):

```shell
cordova plugin add "https://github.com/Incode-Technologies-Example-Repos/CordovaPluginReleases.git#release/[VERSION]-nfc"
```

The SDK uses the camera to capture ID and face, so add the camera plugin:

```shell
cordova plugin add cordova-plugin-camera
```

If you use the geolocation module, add the geolocation plugin as well:

```shell
cordova plugin add cordova-plugin-geolocation
```

Then add the platforms you target. Pin the platform versions that are confirmed compatible with the SDK rather than relying on whatever is installed by default:

```shell
cordova platform add android@^14.0.1
cordova platform add ios@^7.1.1   # macOS only
```

## Android setup

Android resolves the Incode native SDK from Incode's GitHub Maven package repository, which requires authentication:

1. Create a GitHub personal access token with the `read:packages` scope.
2. Expose it to the build as `GITHUB_USERNAME` and `GITHUB_TOKEN` — either as environment variables or as Gradle properties (`github_username` / `github_token`).

The Maven repository that hosts the native dependency is:

```undefined
https://maven.pkg.github.com/Incode-Technologies-Example-Repos/android-omni-packages
```

For the complete dependency-source configuration, see the **Additional Steps for Android** section on the [Cordova SDK page](https://developer.incode.com/docs/cordova-sdk).

## iOS setup

iOS native dependencies are managed through CocoaPods and are installed when you add the iOS platform. If pod installation fails, run `pod repo update` and re-add the platform:

```shell
cordova platform rm ios && cordova platform add ios@^7.1.1
```

## Initialize the SDK and run a flow

On startup, call `initializeSDK` with your Incode API key and base URL, then start an onboarding flow:

```javascript
cordova.exec(
  function () {
    // SDK ready — start onboarding
    cordova.exec(
      function (result) { console.log("Onboarding completed:", result); },
      function (error) { console.log("Onboarding error:", error); },
      "Cplugin",
      "startOnboarding",
      [
        { region: "ALL" },                 // sessionConfig
        [{ module: "addId" }, { module: "addSelfieScan" }, { module: "addFaceMatch" }], // flowConfig
        { recordSession: "false" }         // recordSessionConfig
      ]
    );
  },
  function (err) { console.log("Init error:", err); },
  "Cplugin",
  "initializeSDK",
  ["YOUR_API_KEY", "https://your.api.url", "true", "false", "false", "false", null, null, { enabled: false, forceSSLPinning: false }]
);
```

Keep all credentials out of source control. For complete, copy-paste integration patterns, see [Common Implementation Patterns](https://developer.incode.com/docs/cordova-common-implementation-patterns). For every method and its full signature, see the [API Reference](https://developer.incode.com/docs/cordova-api-reference). For the available capture/validation modules, see [Modules](https://developer.incode.com/docs/cordova-modules).

## Sample app

A complete, runnable example is available in the [CordovaSampleApp](https://github.com/Incode-Technologies-Example-Repos/CordovaSampleApp) repository. Clone it, add your Incode credentials, then build and run on a device:

```shell
cordova run android --device
# or
cordova run ios --device
```

## Troubleshooting

### Android: cannot resolve the Incode SDK

Verify `GITHUB_USERNAME` / `GITHUB_TOKEN` are set and the token has package read access, then re-add the platform:

```shell
cordova platform rm android && cordova platform add android@^14.0.1
```

### iOS: CocoaPods install fails

Run `pod repo update`, then re-add the iOS platform.

### Plugin changes not reflected

Run `cordova prepare`, or remove and re-add the plugin.

## Related documentation

- [Common Implementation Patterns](https://developer.incode.com/docs/cordova-common-implementation-patterns) — three end-to-end integration patterns
- [API Reference](https://developer.incode.com/docs/cordova-api-reference) — every public JavaScript API
- [Modules](https://developer.incode.com/docs/cordova-modules) — capture and validation modules
- [Customization](https://developer.incode.com/docs/cordova-customization) — theming, strings, localization, UX config
- [Known Issues](https://developer.incode.com/docs/cordova-known-issues) — documented issues and workarounds

Updated 18 days ago
