Skip to main content

Overview

In this quickstart, you’ll add Fingerprint to a new React Native project and identify the user’s device. The example use case in this quickstart is stopping new account fraud, where attackers create multiple fake accounts to abuse promotions, exploit systems, or evade bans. However, the steps you’ll follow apply to most use cases. By identifying the device behind each sign-up attempt, login, or transaction, you can flag and block suspicious users early. This guide focuses on the frontend mobile integration. You’ll install the Fingerprint React Native SDK and initialize the client agent to generate a request ID to send to your backend for analysis. To see how to implement fraud prevention with this ID, continue to one of the backend quickstarts after completing this quickstart.
Estimated time: < 10 minutes

Prerequisites

Before you begin, make sure you have the following:
This quickstart only covers the frontend setup. You’ll need a backend server to receive and process the device identification event to enable fraud detection. Check out one of the backend quickstarts after completing this quickstart.

1. Create a Fingerprint account and get your API key

  1. Sign up for a free Fingerprint trial if you don’t already have an account.
  2. After signing in, go to the API keys page in the dashboard.
  3. Copy your public API key; you’ll need it to initialize the client agent.

2. Set up your project

To get started, create a new React Native project. If you already have a project you want to use, you can skip to the next section.
  1. Create a new React Native project using the CLI:
Terminal
  1. Install the project dependencies:
Terminal
  1. Test that your project runs correctly, run:
Terminal
And then in another terminal, for iOS run:
Terminal
or, for Android:
Terminal
You should see the default React Native welcome screen on your simulator or device. If you have trouble running your app, make sure your development environment is properly set up and if using an emulator that it is turned on.

3. Install the client agent

To integrate Fingerprint into your React Native app, first add the Fingerprint React Native SDK to your project.
  1. Install the Fingerprint React Native SDK:
Terminal
  1. Install iOS dependencies using CocoaPods:
Terminal
  1. Add the Fingerprint Maven repository to your Android configuration. Open android/settings.gradle and add the repository to the dependencyResolutionManagement block:
android/settings.gradle
If you’re using Gradle 6.0 or older, modify android/build.gradle instead:
android/build.gradle

4. Initialize the SDK

Now that the SDK is installed, you can import and initialize it in your app.
  1. Open App.tsx and replace the entire file with the following code to set up the Fingerprint provider and basic UI structure:
App.tsx
  1. Replace PUBLIC_API_KEY with your actual public API key from the Fingerprint dashboard. Note: For production, consider using React Native Config or environment variables to securely store your API key.

5. Create the account creation screen

Now you’ll create a simple account creation form that will trigger device identification when the user submits it.
  1. Create a new file called CreateAccountScreen.jsx in your project root with the following content:
CreateAccountScreen.tsx

6. Trigger visitor identification

The code you just added uses Fingerprint’s useVisitorData hook to identify the visitor when they submit the form. Let’s break down the key parts:
  1. Import the hook
CreateAccountScreen.tsx
  1. Initialize the hook
CreateAccountScreen.tsx
This gives you:
  • getData(): A function to trigger visitor identification on demand
  • isLoading: A flag to monitor identification progress
  • error: Any errors that occur during identification
  1. Trigger identification on form submit
CreateAccountScreen.tsx
When making the visitor identification request, you will receive the visitorId as well as a requestId. Instead of using the visitorId returned directly on the frontend (which could be tampered with), you’ll send the requestId to your backend. This ID is unique to each identification event. Your server can then use the Fingerprint Events API to retrieve complete identification data, including the trusted visitor ID and other actionable insights like whether they are using a VPN or are a bot.

7. Run and test the app

  1. Start your development server and build your app:
Terminal
For iOS:
Terminal
For Android:
Terminal
  1. In your app, enter a username and password, then tap Create Account.
  2. You should see an alert showing the request ID, and in your development console (Metro bundler terminal), you should see output similar to:
Output
  1. If you’re using a physical device, you can also use remote debugging tools like Flipper or React Native Debugger to view console logs.
You’re now successfully identifying the device and capturing the request ID, ready to send it to your backend for further fraud prevention logic!

Next steps

To use the identification data for fraud detection (like blocking repeat fake account creation attempts), you’ll need to send the requestId to your backend. From there, your server can call the Fingerprint Events API to retrieve the full visitor information and make decisions. Check out these related resources: