Overview
In this quickstart, you’ll add Fingerprint to a new Flutter 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 Flutter SDK and initialize the client agent to generate an event 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:- Flutter SDK installed (version 3.44.0 or later)
- Basic knowledge of Dart and Flutter development
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
- 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 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 client agent
To integrate Fingerprint into your Flutter app, add the Flutter SDK to your project.- Open
pubspec.yamland add the Fingerprint Flutter 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 client agent to
web/index.htmlinside the<head>tag:
web/index.html
-
For iOS builds, set the minimum deployment target to iOS 15.0 or higher. Open
ios/Runner.xcworkspacein Xcode, select the Runner target, and set General > Minimum Deployments > iOS to15.0. -
If your project has an
ios/Podfile, update its platform line too:
ios/Podfile
- For Android builds, make sure
minSdkinandroid/app/build.gradle(orbuild.gradle.kts) is24or higher. New projects created with Flutter 3.44 already use24. If your project uses Android Gradle plugin (AGP) 8, use Kotlin Gradle plugin 2.2.20 or higher.
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 client agent in your
main()function beforerunApp():
lib/main.dart
- Replace
PUBLIC_API_KEYwith 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 client agent 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 an eventId. Instead of using the visitorId returned directly on the frontend (which could be tampered with), you’ll send the eventId to your backend. 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 yourMyAppclass:
lib/main.dart
- Now add the
_createAccountmethod that calls Fingerprint’sgetmethod. This will capture the device’s details and return aneventId, which you can then send to your backend for your fraud detection logic:
lib/main.dart
Linking your own identifiers: if you already have an identifier for the user at this point, like an account, order, or session ID, pass it as
linkedId. It’s returned as linked_id on the event and indexed, so you can retrieve every event tied to that identifier through the Server API. Learn more about adding more context to your identification events in Linking and tagging information.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 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, see Protecting the JavaScript agent 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 event 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 theeventId 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: