Digipass S3 is now DigipassONE. This section is currently being updated to reflect our new name.

Build and deploy Tutorial app

Prev Next

Tutorial App is an application which contains sample implementation code for performing FIDO operations using the Cordova App SDK. It contains code for SDK calls and illustrates how to handle responses received back from the SDK. It is intended to be a comprehensive example that showcases the functionality contained in the SDK as well as a source of working code that you can copy and paste into your app.

Tutorial App is based on Tutorial Web App because the Cordova and Web App SDKs use the same API. For a complete description of Tutorial App please refer to Tutorial Web App.

In order to build and run Tutorial App, open a terminal window and navigate to the cordova_bom_9.5.0.xx/app_tutorial folder.

Important: Execute all Cordova commands from the Cordova project directory.
For example: cordova_bom_9.5.0.xx/app_tutorial

After installing all Cordova dependencies, switch to the Cordova project directory and run commands to add the plugins and required platforms to your Cordova app. Nok Nok provides platform-specific build scripts that do this work for you. The scripts also build Tutorial App. Install any additional plugins needed for your app development.

When Cordova generates the Android project for Tutorial App, it uses the JDK version that is specified by the JAVA_HOME environment variable.

To use your own Authentication Server instead of the Nok Nok Evaluation Server, edit the file located at ../app_tutorial/www/config/config.js.

  • Modify nnlConfig.host's value to be the URL of your Authentication Server.

  • Verify that the nnlConfig.fido_appid value is the URL of facets.uaf, the trusted facets file.

iOS

To build the tutorial app for iOS, run the following command.

sh build_ios.sh
  1. Connect the iOS device to the computer.

  2. Open the .xcworkspace project file in Xcode and select the correct provisioning profile within the General > Signing section and Deploy the Tutorial App from Xcode

Android

To build the tutorial app for Android, connect the Android device to the computer, and run the following command.

sh build_android.sh

Android: Configuring the Build

  • Add the minimum SDK version for Android to the Android platform tag:

<preference name="android-minSdkVersion" value="25" />

Set this value in the AndroidManifest.xml and config.xml files.

  • If necessary, enable communications with the Digipass S3 Server by signing your app.

  • If you are not using the default keystore, change default.keystore to the keystore you are using. Modify the highlighted lines in the build.json file that is present in the cordova_bom package:

{
    "android": {
        "debug": {
            "keystore": "../<NameOfYourApp>/platforms/android/keystores/default.keystore",
            "storePassword": "android",
            "alias": "androiddebugkey",
            "password" : "android",
            "keystoreType": ""
        },
        "release": {
            "keystore": "../<NameOfYourApp>/platforms/android/keystores/default.keystore",
            "storePassword": "android",
            "alias": "androiddebugkey",
            "password" : "android",
            "keystoreType": ""
        }
    }
}

About the Android Build Script

This section walks you through the commands in build_android.sh. If you want to run these commands, switch to the Cordova project directory first.

  1. Remove any previously installed plugins.

# Remove platforms
cordova platform rm android
# Remove AppSDK plugin
cordova plugin rm com.noknok.pluginappsdkplus
cordova plugin rm com.noknok.pluginappsdkoob
cordova plugin rm com.noknok.pluginappsdk
cordova plugin rm com.noknok.pluginappsdkhms
cordova plugin rm cordova-plugin-statusbar
cordova plugin rm cordova-plugin-advanced-http
cordova plugin rm cordova-plugin-dialogs
cordova plugin rm cordova-plugin-device
cordova plugin rm cordova-plugin-android-permissions
cordova plugin rm cordova-plugin-jumio-mobilesdk
  1. These commands install packages, required plugins, and platforms.

# it generates package.json which will contain all dependencies and project description
# also it helps to avoid warning during build as package.json does not generated automatically
npm init -y
cordova plugin add cordova-plugin-statusbar
cordova plugin add cordova-plugin-advanced-http
cordova plugin add cordova-plugin-dialogs
cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-android-permissions
cordova plugin add cordova-plugin-androidx
cordova plugin add cordova-plugin-androidx-adapter
cordova plugin add https://github.com/Jumio/mobile-cordova.git#v2.12.0
# install components required by android platform
npm i recursive-readdir
# Add platforms
cordova platform add android@13.0.0
  1. Install the components required by plugin_appsdk and add Nok Nok's Cordova plugins.

# install components required by plugin_appsdk
npm i properties-parser
npm i nopt
npm i cordova-common
npm i execa
npm i android-versions
# Add plugins
cordova plugin add ../plugin_appsdk/
cordova plugin add ../plugin_appsdk_plus/
cordova plugin add ../plugin_appsdk_oob/
cordova plugin add ../plugin_appsdk_hms/
  1. Your Android device should be connected before this command executes. By default, Tutorial App is built and launched.

# If build argument is provided only build Android, otherwise launch the app
if [[ $1 = build ]]
then
    cordova build android -- --packageType=apk
else
    cordova run android -- --packageType=apk
fi

iOS: Configuring the Build

In order to run your iOS app, configure your project with your provisioning profiles. You can edit your build configuration from the build.json file. It can be also configured from the .xcodeproj file at platform/ios of your Cordova app. The default location of the Xcode project for the Cordova Tutorial App:

../app_tutorial/platforms/ios/Cordovatutorialapp.xcworkspace

About the iOS Build Script

This section walks you through the commands in build_ios.sh. If you want to run these commands, switch to the Cordova project directory first.

  1. Switch to the Cordova project directory and run the following command to add required packages and plugins to your Cordova app.

cordova plugin add cordova-plugin-whitelist
cordova plugin add cordova-plugin-statusbar
cordova plugin add cordova-plugin-advanced-http
cordova plugin add cordova-plugin-dialogs
cordova plugin add cordova-plugin-device
cordova plugin add https://github.com/Jumio/mobile-cordova.git#v3.5.0
(To deploy your app on the Cordova iOS 6+, this is publicly available)
cordova plugin add @ahovakimyan/cordova-plugin-wkwebviewxhrfix
cordova plugin add ../plugin_appsdk/
cordova plugin add ../plugin_appsdk_plus/
cordova plugin add ../plugin_appsdk_oob/
  1. Run the following command to add any version of the iOS platform to your Cordova app.

cordova platform add ios

you may see errors related to some dependencies that are needed for specific plugins added to the project. At this point you may have to manually install the needed components before you proceed forward

  1. Connect the iOS device to the computer.

  2. Open the .xcworkspace project file in Xcode and select the correct provisioning profile within the General > Signing section and deploy the app or follow step 5

  3. Run the following command to build and deploy the tutorial app on the iOS device.

cordova run ios --verbose --buildConfig

If you see the following error in the Cordova command console, install the “ios_deploy” package on the system where you are running the cordova command:

Error: ios-deploy was not found. Please download, build and install version 1.11.4 or greater from https://github.com/phonegap/ios-deploy into your path, or do 'npm install -g ios-deploy'

On a macOS system, run the following command with administrator credentials (i.e. sudo su) :

# npm install --global --unsafe-perm ios-deploy

You may also see the following console error if the required iPhone OS platform DeviceSupport is not installed for Xcode.

Unable to locate DeviceSupport directory. This probably means you don't have Xcode installed, you will need to launch the app manually and logging output will not be shown!
Error: Error code 253 for command: ios-deploy with args:

To resolve this error, check the iPhone OS version and ensure that the corresponding DeviceSupport is available under

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport

on the macOS system.