Touch Id Authentication in React Native

Updated 28 November 2023

Save

In this blog, we are going to integrate Touch id authentication in React Native.

We have a Touch Id authentication library for biometric authentication and Face Id it is working for both platforms Android and IOS.

Firstly, We have to install the package by using npm or yarn.

or

Secondly, We need to link the library by using :

Now the dependency configuration has completed.

After this, we need the permissions.

In your Manifest file for android :

for IOS in your info.plist file :

 

After providing all this permission just need to import the package and use its function to authenticate function it can take 2 parameters but it is not required.

First Parameter: The first parameter is a string parameter that stands for the title of the dialog box.

Second Parameter: Second parameter is an object that container 3 values title (for android only), color (for android only), and fallbackLabel (for ios only). the object is only for changing the color and title.

 
We can use authenticate function without parameters like mentioned below :
 

With parameters :

We have one function called isSupported, By the help of this function, you can check that the device is support authentication or face authentication. This function also checks that your device has any registered fingerprint or not.

Here we have the final code:

In conclusion, we will achieve this:

 
authentication-promt
authentication-successful
authentication
authentication-failed
too-many-attempts
 

I hope it will help you to integrate fingerprint authentication in your react native apps.

Reference link:- https://www.npmjs.com/package/react-native-touch-id 

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


3 comments

  • arun
  • arun
    • Anand Kashyap (Moderator)
  • Start a Project


      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home