expo-local-authentication

This is an example :


    //Determine whether a face or fingerprint scanner is available on the device.
    LocalAuthentication.hasHardwareAsync().then((isSupported) => {
      if (isSupported) {
        //Determine what kinds of authentications are available on the device
        LocalAuthentication.supportedAuthenticationTypesAsync().then((type) => {
          /*
            1 : fingerprint
            2 : facial
            3 : iris recognition (Android only)
          */
          if (type.indexOf(1) !== -1) {
            //Determine whether the device has saved fingerprints or facial data to use for authentication.
            LocalAuthentication.isEnrolledAsync().then((isEnrolled) => {
              if (isEnrolled) {
                //Attempts to authenticate via Fingerprint/TouchID (or FaceID if available on the device).
                LocalAuthentication.authenticateAsync({
                  promptMessage: "Log In",
                  cancelLabel: "No",
                  fallbackLabel: "Try again",
                  // disableDeviceFallback : false  After several failed attempts the system will fallback to the device passcode
                }).then((data) => {
                  if (data.success) {
                  }
                });
              } else if (type.indexOf(2) !== -1) {
              } else if (type.indexOf(3) !== -1) {
              }
            });
          }
        });
      }
    });

Leave a comment