Git Product home page Git Product logo

react-native-touch-id's Introduction

React Native Touch ID

react-native version npm version npm downloads Code Climate

React Native Touch ID is a React Native library for authenticating users with biometric authentication methods like Face ID and Touch ID on both iOS and Android (experimental).

⚠️ Note: This library is not currently actively maintained. If you're looking for something more stable that "just works", the awesome folks over at Expo have begun open-sourcing some of their modules for compatability with React Native projects not built with Expo. As such you can attempt to use their equivalent library called LocalAuthentication at expo-local-authentication if you run into any issues here!

react-native-touch-id

Breaking changes

Please review all changes in the Changelog

Documentation

Install

npm i --save react-native-touch-id

or

yarn add react-native-touch-id

Support

Due to the rapid changes being made in the React Native ecosystem, we are not officially going to support this module on anything but the latest version of React Native. The current supported version is indicated on the React Native badge at the top of this README. If it's out of date, we encourage you to submit a pull request!

Usage

Linking the Library

In order to use Biometric Authentication, you must first link the library to your project.

Using react-native link

Use the built-in command:

react-native link react-native-touch-id

Using Cocoapods (iOS only)

On iOS you can also link package by updating your podfile

pod 'TouchID', :path => "#{node_modules_path}/react-native-touch-id"

and then run

pod install

Using native linking

There's excellent documentation on how to do this in the React Native Docs.

Platform Differences

iOS and Android differ slightly in their TouchID authentication.

On Android you can customize the title and color of the pop-up by passing in the optional config object with a color and title key to the authenticate method. Even if you pass in the config object, iOS does not allow you change the color nor the title of the pop-up. iOS does support passcodeFallback as an option, which when set to true will allow users to use their device pin - useful for people with Face / Touch ID disabled. Passcode fallback only happens if the device does not have touch id or face id enabled.

Error handling is also different between the platforms, with iOS currently providing much more descriptive error codes.

App Permissions

Add the following permissions to their respective files:

In your AndroidManifest.xml:

<uses-permission android:name="android.permission.USE_FINGERPRINT" />

In your Info.plist:

<key>NSFaceIDUsageDescription</key>
<string>Enabling Face ID allows you quick and secure access to your account.</string>

Requesting Face ID/Touch ID Authentication

Once you've linked the library, you'll want to make it available to your app by requiring it:

var TouchID = require('react-native-touch-id');

or

import TouchID from 'react-native-touch-id';

Requesting Face ID/Touch ID Authentication is as simple as calling:

TouchID.authenticate('to demo this react-native component', optionalConfigObject)
  .then(success => {
    // Success code
  })
  .catch(error => {
    // Failure code
  });

Example

Using Face ID/Touch ID in your app will usually look like this:

import React from "react"
var TouchID = require('react-native-touch-id');
//or import TouchID from 'react-native-touch-id'

class YourComponent extends React.Component {
  _pressHandler() {
    TouchID.authenticate('to demo this react-native component', optionalConfigObject)
      .then(success => {
        AlertIOS.alert('Authenticated Successfully');
      })
      .catch(error => {
        AlertIOS.alert('Authentication Failed');
      });
  },

  render() {
    return (
      <View>
        ...
        <TouchableHighlight onPress={this._pressHandler}>
          <Text>
            Authenticate with Touch ID
          </Text>
        </TouchableHighlight>
      </View>
    );
  }
};

Methods

authenticate(reason, config)

Attempts to authenticate with Face ID/Touch ID. Returns a Promise object.

Arguments

  • reason - optional - String that provides a clear reason for requesting authentication.

  • config - optional - configuration object for more detailed dialog setup:

    • title - Android - title of confirmation dialog
    • imageColor - Android - color of fingerprint image
    • imageErrorColor - Android - color of fingerprint image after failed attempt
    • sensorDescription - Android - text shown next to the fingerprint image
    • sensorErrorDescription - Android - text shown next to the fingerprint image after failed attempt
    • cancelText - Android - cancel button text
    • fallbackLabel - iOS - by default specified 'Show Password' label. If set to empty string label is invisible.
    • unifiedErrors - return unified error messages (see below) (default = false)
    • passcodeFallback - iOS - by default set to false. If set to true, will allow use of keypad passcode.

Examples

const optionalConfigObject = {
  title: 'Authentication Required', // Android
  imageColor: '#e00606', // Android
  imageErrorColor: '#ff0000', // Android
  sensorDescription: 'Touch sensor', // Android
  sensorErrorDescription: 'Failed', // Android
  cancelText: 'Cancel', // Android
  fallbackLabel: 'Show Passcode', // iOS (if empty, then label is hidden)
  unifiedErrors: false, // use unified error messages (default false)
  passcodeFallback: false, // iOS - allows the device to fall back to using the passcode, if faceid/touch is not available. this does not mean that if touchid/faceid fails the first few times it will revert to passcode, rather that if the former are not enrolled, then it will use the passcode.
};

TouchID.authenticate('to demo this react-native component', optionalConfigObject)
  .then(success => {
    AlertIOS.alert('Authenticated Successfully');
  })
  .catch(error => {
    AlertIOS.alert('Authentication Failed');
  });

isSupported()

Returns a Promise that rejects if TouchID is not supported. On iOS resolves with a biometryType String of FaceID or TouchID.

Examples

const optionalConfigObject = {
  unifiedErrors: false // use unified error messages (default false)
  passcodeFallback: false // if true is passed, itwill allow isSupported to return an error if the device is not enrolled in touch id/face id etc. Otherwise, it will just tell you what method is supported, even if the user is not enrolled.  (default false)
}

TouchID.isSupported(optionalConfigObject)
  .then(biometryType => {
    // Success code
    if (biometryType === 'FaceID') {
        console.log('FaceID is supported.');
    } else {
        console.log('TouchID is supported.');
    }
  })
  .catch(error => {
    // Failure code
    console.log(error);
  });

Errors

There are various reasons why biomentric authentication may not be available or fail. TouchID.isSupported and TouchID.authenticate will return an error representing the reason.

iOS Errors

Format:

{
  name: "TheErrorCode",
  message: "the error message",
  details: {
    name: "TheErrorCode",
    message: "the error message"
  }
}
name message
LAErrorAuthenticationFailed Authentication was not successful because the user failed to provide valid credentials.
LAErrorUserCancel Authentication was canceled by the user—for example, the user tapped Cancel in the dialog.
LAErrorUserFallback Authentication was canceled because the user tapped the fallback button (Enter Password).
LAErrorSystemCancel Authentication was canceled by system—for example, if another application came to foreground while the authentication dialog was up.
LAErrorPasscodeNotSet Authentication could not start because the passcode is not set on the device.
LAErrorTouchIDNotAvailable Authentication could not start because Touch ID is not available on the device
LAErrorTouchIDNotEnrolled Authentication could not start because Touch ID has no enrolled fingers.
LAErrorTouchIDLockout Authentication failed because of too many failed attempts.
RCTTouchIDUnknownError Could not authenticate for an unknown reason.
RCTTouchIDNotSupported Device does not support Touch ID.

More information on errors can be found in Apple's Documentation.

Android errors

Format:

{
  name: "Touch ID Error",
  message: "Touch ID Error",
  details: "the error message",
  code: "THE_ERROR_CODE"
}

isSupported:

name message details code
Touch ID Error Touch ID Error Not supported. NOT_SUPPORTED
Touch ID Error Touch ID Error Not supported. NOT_AVAILABLE
Touch ID Error Touch ID Error Not supported. NOT_PRESENT
Touch ID Error Touch ID Error Not supported. NOT_ENROLLED

authenticate:

name message details code
Touch ID Error Touch ID Error Not supported NOT_SUPPORTED
Touch ID Error Touch ID Error Not supported NOT_AVAILABLE
Touch ID Error Touch ID Error Not supported NOT_PRESENT
Touch ID Error Touch ID Error Not supported NOT_ENROLLED
Touch ID Error Touch ID Error failed AUTHENTICATION_FAILED
Touch ID Error Touch ID Error cancelled AUTHENTICATION_CANCELED
Touch ID Error Touch ID Error Too many attempts. Try again Later. FINGERPRINT_ERROR_LOCKOUT
Touch ID Error Touch ID Error Too many attempts. Fingerprint sensor disabled. FINGERPRINT_ERROR_LOCKOUT_PERMANENT
Touch ID Error Touch ID Error ? FINGERPRINT_ERROR_UNABLE_TO_PROCESS,
Touch ID Error Touch ID Error ? FINGERPRINT_ERROR_TIMEOUT,
Touch ID Error Touch ID Error ? FINGERPRINT_ERROR_CANCELED,
Touch ID Error Touch ID Error ? FINGERPRINT_ERROR_VENDOR,

Unified errors

Format:

{
  name: "TouchIDError",
  message: "the error message",
  code: "THE_ERROR_CODE"
}
name message code
TouchIDError Authentication failed AUTHENTICATION_FAILED
TouchIDError User canceled authentication USER_CANCELED
TouchIDError System canceled authentication SYSTEM_CANCELED
TouchIDError Biometry hardware not present NOT_PRESENT
TouchIDError Biometry is not supported NOT_SUPPORTED
TouchIDError Biometry is not currently available NOT_AVAILABLE
TouchIDError Biometry is not enrolled NOT_ENROLLED
TouchIDError Biometry timeout TIMEOUT
TouchIDError Biometry lockout LOCKOUT
TouchIDError Biometry permanent lockout LOCKOUT_PERMANENT
TouchIDError Biometry processing error PROCESSING_ERROR
TouchIDError User selected fallback USER_FALLBACK
TouchIDError User selected fallback not enrolled FALLBACK_NOT_ENROLLED
TouchIDError Unknown error UNKNOWN_ERROR

License

Copyright (c) 2015, Naoufal Kadhom

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

react-native-touch-id's People

Contributors

2vm avatar aidurber avatar aleksandrzhukov avatar dannyvanderjagt avatar davidgruebl avatar ehellman avatar hannesmcman avatar ianoshorty avatar jspaine avatar maddijoyce avatar mahlon-gumbs avatar manduro avatar markrickert avatar mchudy avatar mcuelenaere avatar mironiasty avatar naoufal avatar nikdemyankov avatar pilsy avatar richardvanwill avatar rodan-lewarx avatar saeedzhiany avatar srulfi avatar taranda avatar vanden1985 avatar zibs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-touch-id's Issues

Android FingerprintManager not supported for API lower than 23

I was testing the module on a couple of devices with respectively API level 21 and 17.
With both of the devices I could manage to install the signed release APK but the app would just crash saying "the app has stopped".
From the Logcat in Android Studio I managed to get a stacktrace with a java.lang.RuntimeException: Could not invoke FingerprintAuth.isSupported error.
I then bumped into this SO answer which states that "FingerprintManager is supported in API 23 and Higher", which is confirmed here.

The same APK is working on a Nexus 5X with Android version 8, so API level should be 26.

Are there any known workarounds at the moment?

Declare touch-id compatibility

I notice there is an error for when the device doesn't support touchID. Is there a way to check beforehand if touchID is supported on the device?

if (TouchID.isSupported) {
  // this device has a touchID sensor
} else {
  // this is an older device that cannot scan fingerprints
}

Not supported on Android 6.0 API - bug

While catching error on TouchId.isSupported I'm getting info that device doesn't support fingerprint authorization even though Android is supporting such feature from api level 23(6.0)

fatal error: 'React/RCTBridgeModule.h' file not found

Error
When trying to build the iOS app, it fails with the error

In file included from /Users/nbdeg/Documents/Coding/Projects/Homeroom/Homeroom-App/node_modules/react-native-touch-id/TouchID.m:1:
fatal error: 'React/RCTBridgeModule.h' file not found
#import <React/RCTBridgeModule.h>

Versions

System
  platform        darwin                                                                                                             
  arch               x64                                                                                                                
  cpu                4 cores | Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz  
  directory        /Users/nbdeg/Documents/Coding/Projects/Homeroom/Homeroom-App                                                       

JavaScript
  node              8.9.1        /usr/local/bin/node  
  npm               5.5.1        /usr/local/bin/npm   
  yarn               1.3.2        /usr/local/bin/yarn  

React Native
  react-native-cli   2.0.1       
  app rn version     0.51.0      

Ignite
  ignite             2.0.0        /usr/local/bin/ignite  

Android
  java               1.8.0_144    /usr/bin/java                     
  android home       -            /Users/nbdeg/Library/Android/sdk  

iOS
  xcode              9.2    

Expected Behavior
The app builds without errors

Thanks in advance. Let me know if you need any more info.

Improving isSupported on Android

On the Android version, is there any reason why the isSupported method does not return a Promise?

https://github.com/naoufal/react-native-touch-id/blob/master/TouchID.android.js#L9

Returning Promise.reject() or something similar would allow the same detection code to be used across both platforms. Currently, I do this:

const promise = TouchID.isSupported();
if (!promise) {
  bad();
}
promise.then(() => {
  good();
})
.catch(() => {
  bad();
});

I would submit a PR with this idea, but it may be a breaking change for some (though most code written like my example above should interpret the change fine, unless there is a new error code), so wanted to check first if there was a reason behind the current approach.

yarn.lock uses artifacts.netflix.com

It looks as though a yarn.lock file has been committed which doesn't need to be in there. Installing with Yarn fails as a result because the yarn.lock includes Netflix proxy URLs.

yarn install v0.21.3
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error An unexpected error occurred: "http://artifacts.netflix.com/api/npm/npm-netflix/globals/-/globals-8.18.0.tgz: connect ETIMEDOUT 35.166.143.188:80".
info If you think this is a bug, please open a bug report with the information provided in "/Users/elliott/ueno/react-native-touch-id/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.```

Closing touch-id popup leads to recreating and remounting the view

After witnessing some weird behavior of animations that were triggered by the response from touch id I figured out, that when ever the touch id prompt is closed (no matter if by successful login or cancel) the view which called the prompt will be recreated and remounted.

This seems like a bug to me as it creates weird behavior because the state of the view is not preserved.

Property 'biometryType' not found on object of type 'LAContext

Hello,

While trying to install this lib (4.0.0) I ran into the following error:

error: property 'biometryType' not found on object of type 'LAContext *' return context.biometryType == LABiometryTypeFaceID ? @"FaceID" : @"TouchID"
`error: use of undeclared identifier 'LABiometryTypeFaceID'
return context.biometryType == LABiometryTypeFaceID ? @"FaceID" : @"TouchID";

I also tried with a fresh React Native install (react-native init), I did linked the libraries & the npm install run fine. The errors are returned when I run react-native run-ios

3.1.0 package work as intended

Any idea why ?

Enter password give Authentication Failed

Hi, i'm using you example on iphone 6s 9.3.5 (deivce)
when i'm failed to enter with the touch ID and asking to enter password
i click enter password and instantly get message "Authentication Failed" before i do anything
can you please help me ?
thanks

Make API surface consistent for android

Hey,

I know that Andorid isn't currently supported but it would be nice if i could call the isSupported function in a consistent manner and expect it to simply say 'No this isn't supported' on android the same way i would expect it to happen on IOS, i.e. return a Promise which resolves false.

Currently i have a hack in my node_modules to locally fix this problem:

/**
 * Stub of TouchID for Android.
 *
 * @providesModule TouchID
 * @flow
 */
'use strict';

export default {
  isSupported() {
    return new Promise((resolve, reject) => {
      resolve(false);
    });
  }
};

Storing secure data under touch-id

Hi!

I'm sorry to post this here, if it's out of place.. but I've not found any answers that would help me understand what the relationship is with touch ID, this project and authentication.

I would like to store secure information on the device and have it only accessible via touch ID, from this library. This would be ideal if there were some token or key exposed by touch ID authentication, but I haven't found anything in touch-id docs that would elude to such a thing existing.

Is there something I'm missing, or is the intention behind touchID just different?

touchID breaks Cmd+R in simulator

I am very grateful to you for this component. It is extremely important for our app.

The problem is that in the simulator, after successful authentication, Cmd+R stops working. Strangely, if you call TouchID.authenticate() again and cancel it, it starts working again.

Unification of error messages across platforms

have you thought about unification of error messages across platforms?

Curently there are documented iOS errors, these have proper names, messages and details. But errors on Android are entirely different - all returns Touch ID Error and error message is in details instead of message, etc.

Wouldnt it be better if this library would throw own errors instead that would be the same across platforms?

Issue: Unrecognized platform name iOS

Hi,

I am getting error in method -

  • (NSString *)getBiometryType:(LAContext *)context
    {
    if (@available(iOS 11, *)) {
    return context.biometryType == LABiometryTypeFaceID ? @"FaceID" : @"TouchID";
    }

    return @"TouchID";
    }

Error: Unrecognized platform name iOS
Property 'biometryType' not found on object of type 'LAContext *'
Use of undeclared identifier 'LABiometryTypeFaceID'

Version - "react-native-touch-id": "^4.0.0"

Missing tags from push

Hi!

Thanks for the release of 3.0.0 and supporting RN 0.40 — I've just noticed though that there's no git tags pushed for 2.0.3, 2.0.4 and 3.0.0; Could you please push them.

Thanks,
Emelia

undefined is not an object

Hi guys,

I keep getting this message - undefined is not an object (evaluating 'NativeTouchID.isSupported')
undefined is not an object (evaluating 'NativeTouchID.authenticate')

did react-native link many times
tried rm -rf ./node_modules && npm install && react-native link

this is my code

import React, { Component } from 'react';
import { View, Text, TouchableHighlight, Alert } from 'react-native';
import TouchID from "react-native-touch-id";

export default class Authentication extends Component {
    componentDidMount() {
        TouchID.isSupported()
            .then(supported => {
                console.log('it is supported');
            })
            .catch(err => {
                console.log(err.message);
            })
    }
    authHandler() {
        TouchID.authenticate('to demo this component')
            .then(success => {
                console.log(success);
                Alert.alert('auth successed');
            })
            .catch(err => {
                Alert.alert(err.message);
            })
    }
    render() {
        return (
            <View style={ styles.container }>
              <TouchableHighlight onPress={ this.authHandler }>
                <Text>
                  Authenticate with Touch id
                </Text>
              </TouchableHighlight>
            </View>
        )
    }
}

const styles = {
    container: {
        flex: 1,
        backgroundColor: '#fff',
        alignItems: 'center',
        justifyContent: 'center',
    }
}

peerDependencies: react-native: >=0.4.0

npm i --save react-native-touch-id

npm error (npm:2.14.12, node:4.2.4)

With react-native-cli: 0.1.10, the default react-native:0.18.0-rc does not appear to be working. ERR! peerinvalid.

It works when react-native is downgraded to 0.17.0.

Use this and Facebook login

Hi, thank you so much for building this, it looks so COOL! I want to use it for my app, which uses Facebook login, was wondering if I want to integrate the two, how should I approach this?

Again, thank you so much!

can't show scanner form

Hi,
In my case sometimes can't show prompt to scanner form after it always can't show until uninstall app or reset device. it's return exception RCTTouchIDUnknownError.

i'm using react-native-touch-id 3.1.0 on Iphone 7Plus - ios 11 and iphone6s - ios 10

Missing the required parameter 'password' ...

It gives me this message when I call the authenticate method, and it returns some value to me:

Missing the required parameter 'password' when calling authorize

handleException
ExceptionsManager.js:58

reportFatalError
error-guard.js:30

guard
MessageQueue.js:48

callFunctionReturnFlushedQueue
MessageQueue.js:107

My react-native version: 0.36.1

Cannot read property 'authenticate' of undefined

Running this snippet of code results in the error in the title, but TouchID.authenticate is a function that is printed to the console. Not sure what is causing this issue.

AsyncStorage.getItem('UserID', (err, result) => {
      console.log(err);
      if (result != null) {
        console.log(TouchID.authenticate);
        console.log(result);
        TouchID.authenticate('Login Process').then(success => {
          console.log('hi');
        }).catch(error => {
          console.log(error);
        });
      }

    });

Running this on an iPhone 6 9.3 simulator.

Android crashes when authentication fails at second time

It seems that android still keep the Fingerprint working after the first authentication.

ERROR: RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code.

TEST: Loop until authentication() returns true, at the second time this will crash.

async validateTouchId(){
        let isAuthOk = false;
        while(!isAuthOk){

            try{
                let responseAuth = await TouchID.authenticate('Authentication');

                if(responseAuth){
                    isAuthOk = true;
                    return true;
                }else{
                    throw responseAuth;
                }

            } catch (e){
                console.log("Error",e);

                let successPromise = await new Promise((resolve, reject) => {
                    Alert.alert(
                        'Auth',
                        "Auth again.",
                        [
                            {text: 'Login again', onPress: () => {
                                    resolve(false);
                                }},
                            {text: 'Try again', onPress: async () => {
                                    resolve(true);
                                }},
                        ]
                    );
                });

                if(!successPromise){
                    return false;
                }
            }
        }
    }

Is this supported on Expo?

... or does the app have to deployed to the device from xcode?

My code always fails.

"Touch ID is not supported on your device."

_loginIDHandler() {
    TouchID.isSupported()
    .then(supported => {
      TouchID.authenticate('Easily login into OTCMe.')
      .then(success => {
        AlertIOS.alert('Authenticated Successfully');
      })
      .catch(error => {
        AlertIOS.alert('Authentication Failed');
      });
    })
    .catch(error => {
      AlertIOS.alert('Touch ID is not supported on your device.');
    });
  }

Android native bridge broken

Commands:
yarn add react-native-touch-id
react-native link react-native-touch-id

In output to second command there are no android linking info, also there is no android folder under node_modules/react-native-touch-id and therefore no changes in native android files.

react-native-touch-id v3.1.0

Android support

This is by the far, the best touch auth package for RN. Hope it will support android in near future

RCTTouchIDUnknownError, TouchID do not work with multiple apps

I have 2 distinct apps generated from the same codebase. Let's say both has the same functionality but their theme colors are different. I want to use TouchID for login to the both APP1 and APP2. When I build and install my code initially for APP1, everything works fine and I can use TouchID successfully to login (login means fetching some info from Keychain). Then I use the same code base with different colors and different ios files (I change info.plist etc. to make my apps distinct.) to build and install APP2 to my phone while APP1 is installed. The weird thing happens here. I can use TouchID in my latest installed APP2 correctly but my APP1 stops working with TouchID. APP1 doesn't crash but starts to give RCTTouchIDUnknownError. The same pattern holds for n apps where n'th app works with TouchID while previously working n-1'th app starts to fail to RCTTouchIDUnknownError. Anyone has any idea?

Face ID Support for iOS - iPhone X

How are you planning to support Face ID?

I've just tested this module (v3.1.0) on an iPhone X and although it does work correctly (so far), it needs some additional detection around Face ID.

Ideally we should be able to present users with the correct wording when opting - for example in our App we'll show something like 'Use Touch ID?' as an opt-in when logging in (or as a setting switch). If there was additional detection for Face ID e.g. FaceId.isSupported() then it presents a simple way for RN to show the user the correct option.

RCTTouchIDUnknownError - 100% of the time after certain criteria

Hi,

I've implemented the following rough structure which fires before allowing access to stored login API credentials.

TouchID.isSupported()
        .then(supported => {
        TouchID.authenticate(`${Manifest.name} App credentials for ${username}`)
                  .then(success => {
                          // ... access credentials & login
                  })
                  .catch(err => {
                          // ... don't login
                  })
        })

It works just fine until a particular point in production Apps. After which, authenticate() gives back RCTTouchIDUnknownError 100% of the time. I can happily use isSupported() to attempt to prompt the user and re-enable Touch ID, but it still refuses to show the Touch ID dialogue.

Are there any known issues with this, or any particular reasons why Touch ID would be failing with an 'unknown' error?

Sorry for any vagueness here but I'm at a point where there's no further info available to me. The application's state is correct as I would expect the Touch ID call to fire at this point, but the error is thrown instead.

touch id no longer supported if user fails to authenticate too many times

Thanks for the great lib!

If a user enters an invalid touch too many times, touch id is permanently no longer supported for the app. Is this intended behavior? Seems like strange behavior and in our case not desirable. Any insight into this?

Ideally I think, it would be up to application devs if we want to disable touch support on too many failures. or at least there should be a way to enable it again?

Thanks!!!

Is it possible to give the option to change the title?

Currently, it shows the red fingerprint, and a title of Touch Id for <AppRegistry.registerComponent>
it doesn't match the branding we intend for our app. Is there a way that I can provided a different title?

Thanks!

Android version < 5.0 crashes while building

Got an error java.lang.VerifyError: com/rnfingerprint/FingerprintAuthModule while tried to run react-native run-android which actually makes impossible to launch the application on android version 4.4.2 and 4.4.4. On android 5+ it works fine.
The trouble shooting while application compiling, because even if I remove all JS code with importing/using TouchID in project the error is still.

error
export

Full error code:
`
01-23 12:23:29.021 28712-30617/io.apla E/dalvikvm: Could not find class 'android.hardware.fingerprint.FingerprintManager', referenced from method com.rnfingerprint.FingerprintAuthModule.authenticate

01-23 11:05:39.361 12299-12614/io.apla E/AndroidRuntime: FATAL EXCEPTION: Thread-131
java.lang.VerifyError: com/rnfingerprint/FingerprintAuthModule
at com.rnfingerprint.FingerprintAuthPackage.createNativeModules(FingerprintAuthPackage.java:18)
at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:106)
at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1196)
at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1166)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1099)
at com.facebook.react.ReactInstanceManager.access$800(ReactInstanceManager.java:112)
at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:927)
at java.lang.Thread.run(Thread.java:856)`

Is there any solutions? Or at least opportunity to dynamically linking the library depends on Android version?

How to determine touch id is turn off

My device is supported touch id but i turn off touch id feature.
isSupported method can check touch id is supported or not
How can i determine that touch id is turn off

TouchID : Cannot read property 'isSupported' of undefined

Here is the code I'm running

demoTouchID() { TouchID.isSupported() .then((success) => { console.log("TOUCHID WORKS"); }) .catch((error) => { console.log("TOUCHID ERROR: ", error); }) }

When I tap the button that this function is attached to I get an error saying :

Cannot read property 'isSupported' of undefined
at TouchID.ios.js:18
at tryCallTwo (core.js:45)
at doResolve (core.js:200)
at new Promise (core.js:66)
at Object.isSupported (TouchID.ios.js:17)
at Object.demoTouchID [as onPress] (BasicAuthApp.js:65)
at Object.touchableHandlePress (TouchableOpacity.js:125)
at Object._performSideEffectsForTransition (Touchable.js:742)
at Object._receiveSignal (Touchable.js:660)
at Object.touchableHandleResponderRelease (Touchable.js:433)

It also occurs when using .authenticate()

Remove fingerprint dialog on android

On iOS devices there system dialog for fingerprint.
Common case for android is listening fingerprint event without dialog. I have tried many apps with supporting fingerprint for android, there is no one with dialog like on iOS.
Can we introduce option to not showing this dialog android?

Any way of removing the "Enter Password" section?

I've poked around the code a little bit and can't see where the "Enter Password" fallback message is getting setup. I'm wondering if there is any way to change this string, or remove this section entirely and only have the 'Cancel' option.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.