naoufal / react-native-touch-id Goto Github PK
View Code? Open in Web Editor NEWReact Native authentication with the native Touch ID popup.
Home Page: https://www.npmjs.com/package/react-native-touch-id
React Native authentication with the native Touch ID popup.
Home Page: https://www.npmjs.com/package/react-native-touch-id
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?
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!
tried iOS and Android..
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 ?
TouchID.isSupported()
.then(biometryType => {
console.log(biometryType)
})
The above code snippet logs "true" instead of TouchID or FaceID..
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.```
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!
touchID is support both android and IOS both technolgy with finger print .
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.
Hi,
on RN 0.30.0 I have a issue on Android when build release, my application has error "Application has stopped".
please help me fix it and build new version. Thanks you very much!
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?
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
As caption. Something like the touch id hash.
Because i want to send it with ID to server to get the token back. Thanks all.
here requires invariant to be installed globally, so either add to package.json or remove if not needed..
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);
});
}
};
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?
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?
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"
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?
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.
Is there a way to determine where the user's phone supports touch id vs face id? For example, we would like to determine whether our UI prompts user for facial recognition or touch id. thanks for the great lib!
I am trying to get the TouchID prompt to appear on component mount but when I do that it just says it failed and never prompted me for it. Any way to have it go straight to prompt?
This is by the far, the best touch auth package for RN. Hope it will support android in near future
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
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.
This error occurs with React Native 0.41
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.
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
... 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.');
});
}
Is it possible to show Touch ID authentication pop-up in landscape mode?
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
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',
}
}
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.
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 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.
The title when prompted for touch id is "Touch ID for (app name)", is there any way to change it?
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!
Right now your are using deviceOwnerAuthenticationWithBiometrics
which only support Touch ID, while deviceOwnerAuthentication
support both, Touch ID and password, look here
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;
}
}
}
}
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
}
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.
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
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
It seems that on android user has only one attempt to match fingerprint.
Is there any possibilities to increase attempt count?
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()
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.
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.
Please, update version and tag codebase, because npm installs some old codebase. You can see actual install result in tag branch 3.1.0
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)
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!!!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.