Overview
In this quickstart, you’ll add Fingerprint to a new Flutter project and identify the user’s device. The example use case we’ll use for 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 front-end mobile integration. You’ll install the Fingerprint Flutter SDK and initialize the client to generate a request ID to send to your back end for analysis. To see how to implement fraud prevention with this ID, continue to one of our back-end quickstarts after completing this quickstart.Estimated time: < 10 minutes
Prerequisites
Before you begin, make sure you have the following:- Flutter SDK installed (version 3.13.0 or later)
- Basic knowledge of Dart and Flutter development
This quickstart only covers the front-end setup. You’ll need a back-end
server to receive and process the device
identification event to enable fraud detection. Check out one of our back-end
quickstarts after completing this
quickstart.
1. Create a Fingerprint account and get your API key
- Sign up for a free Fingerprint trial if you don’t already have an account.
- After signing in, go to the API keys page in the dashboard.
- Copy your public API key; you’ll need it to initialize the Fingerprint client agent.
2. Set up your project
To get started, create a new Flutter project. If you already have a project you want to use, you can skip to the next section.- Open your terminal and run:
Terminal
- Open the project in your preferred editor (VS Code, Android Studio, etc.).
3. Install the Fingerprint SDK
To integrate Fingerprint into your Flutter app, add the SDK to your project.- Open
pubspec.yamland add the Fingerprint SDK and logger dependencies:
pubspec.yaml
logger package provides better formatted console output with timestamps and log levels, making it easier to debug and see results.
- Run
flutter pub getto install the dependencies. - For web support, add the JavaScript agent loader to
web/index.htmlinside the<head>tag:
web/index.html
- For iOS builds, update the minimum deployment target to iOS 13.0 or higher.
-
Open
ios/Podfileand update the platform line at the top:
ios/Podfile
- For Android builds, you may need to install and configure the NDK. If you encounter build issues:
- Install NDK version
27.0.12077973through Android Studio (Tools > SDK Manager > SDK Tools > NDK) - Set the NDK version in
android/app/build.gradle.kts:
android/app/build.gradle.kts
4. Initialize the SDK
Now that the SDK is installed, you can import and initialize it in your app.- Open
lib/main.dart, add the following imports, and initialize the logger:
lib/main.dart
- Initialize the Fingerprint client in your
main()function beforerunApp(), make sure yourmain()function is async:
lib/main.dart
- Replace
<your-public-api-key>with your actual public API key from the Fingerprint dashboard. Make sure the correct region is being used to match your workspace.
5. Trigger visitor identification
Now that the Fingerprint client is initialized, you can identify the visitor when needed. In this case, that’s when the user taps a Create Account button. When making the visitor identification request, you will receive thevisitorId as well as a requestId. Instead of using the visitorId returned directly on the front end (which could be tampered with), you’ll send the requestId to your back end. This ID is unique to each identification event. Your server can then use the Fingerprint Events API and retrieve the complete identification data, including the trusted visitor ID and other actionable insights like whether they are using a VPN or are a bot.
Add a basic sign-up UI
- Create a simple account creation form in your
buildmethod of youMyAppclass:
lib/main.dart
- Now add the
_createAccountmethod that calls Fingerprint’sgetVisitorDatamethod. This will capture the device’s details and return arequestId, which you can then send to your back end for your fraud detection logic:
lib/main.dart
6. Run the app
- If your Flutter app isn’t already running, start it with
flutter run - Choose your target device:
- For mobile: Use a connected physical device for best results (simulators/emulators may have network connectivity issues)
- For web: Run
flutter build webthenflutter run -d chrometo test in the browser
- If testing on web and you have any ad blockers, turn them off for localhost. For production Flutter web apps, view our documentation to learn how to protect your Fingerprint implementation from ad blockers.
- Enter a username and password, then click Create Account.
- Check your console output (in your IDE or terminal) and you should see the request ID in the formatted logger output:
Output
Next steps
To use the identification data for fraud detection (like blocking repeat fake account creation attempts), you’ll need to send therequestId to your back end. From there, your server can call the Fingerprint Events API to retrieve the full visitor information and make decisions.
Check out these related resources: