-1

I want to use the cordova-plugin-fingerprint-aio to add fingerprint capability to my app.

The popup telling me that I have to put my finger is well showed. My fingerprint seems accepted on the screen.

But none of the callback for Fingerprint.show are invoked. My code is yet an almost copy/paste of the documentation :

function doSubmit() {
  var login = document.getElementById("login")
  var password = document.getElementById("password")

  Fingerprint.isAvailable(isAvailableSuccess, isAvailableError);

  function isAvailableSuccess(result) {

    console.log("Fingerprint available");

    showPopupAuthentication()
  }

  function isAvailableError(message) {
    console.error(message);
  }

}

function showPopupAuthentication() {
  Fingerprint.show({
    clientId: "Fingerprint-Demo",
    clientSecret: "password" //Only necessary for Android
  }, successCallback, errorCallback);

  function successCallback(){
    console.log("Authentication successfull"); // this is not invoked
  }

  function errorCallback(err){
    console.error("Authentication invalid " + err); // neither this one !!
  }
}

Do you have a similar behavior?

Cordova CLI 8.0.0 Cordova Android 7.0 cordova-plugin-fingerprint-aio 1.3.7

I use an Android 7.0 physical device to test my app.

pom421
  • 1,731
  • 19
  • 38

1 Answers1

0

This was due to the fact I use a form and I forgot to prevent default the standard behavior of it.

<form onsubmit="return false">
    <input placeholder="login" name="login" id="login">
    <input placeholder="password" name="password" id="password">
    <button onclick="doSubmit()">OK</button>
    <button type="reset">Reset</button>
</form>

The callbacks are now invoked.

pom421
  • 1,731
  • 19
  • 38