DedrisFrameworkDedrisFramework

← Plugins  /  Biometric Auth

👆

Biometric Auth

cordova-plugin-fingerprint-aio
iOS · Touch/Face ID Android · BiometricPrompt

This community plugin ("All-In-One") gives you a single, cross-platform API for biometric authentication — Touch ID and Face ID on iOS, and the BiometricPrompt fingerprint/face dialog on Android. You check availability, then show the system prompt and react to the result.

Installation

terminal
cordova plugin add cordova-plugin-fingerprint-aio

On iOS you can set the Face ID usage string with the FACEID_USAGE_DESCRIPTION install variable.

API

The plugin is exposed as Fingerprint after deviceready:

MethodDescription
Fingerprint.isAvailable(success, error, options)Reports whether biometrics are set up; success receives the type, e.g. "finger", "face" or "biometric".
Fingerprint.show(options, success, error)Displays the native authentication prompt and calls success when the user is verified.
Fingerprint.registerBiometricSecret(options, success, error)Stores a secret protected behind biometric authentication.
Fingerprint.loadBiometricSecret(options, success, error)Retrieves a stored secret after a successful authentication.

Options

KeyTypeDescription
titleStringTitle shown on the prompt.
subtitleStringSecondary line under the title (Android).
descriptionStringLonger descriptive text.
fallbackButtonTitleStringLabel for the fallback (e.g. passcode) button.
disableBackupBooleanHide the device-credential fallback and require biometrics only.

Usage example

Check availability, then prompt the user to unlock:

www/js/app.js
function unlock() {
  Fingerprint.isAvailable(
    function (type) {
      Fingerprint.show(
        { title: "Unlock DedrisApp", disableBackup: false },
        function () {
          console.log("Authenticated with " + type);
        },
        function (err) {
          console.error("Auth failed: " + err.message);
        }
      );
    },
    function (err) {
      console.log("Biometrics unavailable: " + err.message);
    }
  );
}

Tips

📚 Source: the technical reference on this page is based on the cordova-plugin-fingerprint-aio project (MIT licensed), maintained by the open-source community. Descriptions and examples have been rewritten in DedrisFramework's own words. This plugin is not part of the Apache Cordova core.
← Back to plugins Start a project