Cordova Plugin Fingerprint All-In-One

For Android and iOS

Gitter chat GitHub license Build Status Issue Count

NPM

This plugin provides a single and simple interface for accessing fingerprint APIs on both Android 6+ and iOS.

Features

Platforms

How to use

Tutorial about using this plugin with Ionic thanks to Paul Halliday

Examples

ngCordova Example

Ionic Native Example


Install

Install from NPM

cordova plugin add cordova-plugin-fingerprint-aio --save

If you want to set a FaceID description use:

cordova plugin add cordova-plugin-fingerprint-aio --variable FACEID_USAGE_DESCRIPTION="Login now...."

Use the release candidate for testing the latest fixes

You can use preview versions with the rc tag on npm.

cordova plugin add cordova-plugin-fingerprint-aio@rc

Use this Github repo

Get the latest development version. Not recommended!

cordova plugin add https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio.git

Check if fingerprint authentication is available

Fingerprint.isAvailable(isAvailableSuccess, isAvailableError);

    function isAvailableSuccess(result) {
      /*
      result depends on device and os. 
      iPhone X will return 'face' other Android or iOS devices will return 'finger' Android P+ will return 'biometric'
      */
      alert("Fingerprint available");
    }

    function isAvailableError(error) {
      // 'error' will be an object with an error code and message
      alert(error.message);
    }

Show authentication dialogue

Fingerprint.show({
      description: "Some biometric description"
    }, successCallback, errorCallback);

    function successCallback(){
      alert("Authentication successful");
    }

    function errorCallback(error){
      alert("Authentication invalid " + error.message);
    }

Optional parameters

Constants

Thanks to the authors of the original fingerprint plugins

Some code is refactored from their projects and I learned how to make Cordova plugins from their great plugins:

@EddyVerbruggen and @mjwheatley

Android

iOS

Starting with version 3.0.0 the iOS and Android parts are written from scratch.

License

The project is MIT licensed: MIT.