Skip to main content
Verified location checks (Radar.trackVerified()) and device risk checks (Radar.revealRisk()) need a fraud plugin in addition to the core SDK. By the end of this page, the plugin will be installed for your platform, device attestation will be configured, and a verified location check will return a token instead of ERROR_PLUGIN.
Fraud detection and verified location checks are available on the Enterprise plan.
Before you test, enable Fraud for your project under Fraud on the Settings page of the Radar dashboard.

Compatibility

Use a core SDK version and a plugin version from the same row. A missing or incompatible plugin makes Radar.trackVerified() return ERROR_PLUGIN. The iOS plugin requires iOS 15 or later. What each platform supports: The Cordova plugin (3.9.1) and the .NET MAUI package (RadarIO.Xamarin 3.9.3) pair with the 3.9 native SDKs, which predate the fraud plugins on this page. They expose the trackVerified(), trackVerifiedToken(), and startTrackingVerified() methods of those SDKs, and they don’t expose revealRisk(). See the verified location section of the Cordova SDK or .NET MAUI SDK reference. The Capacitor plugin (capacitor-radar 4.1.1) includes its own fraud plugins for iOS and Android, so you don’t install the plugins on this page. Their versions are outside the ranges in the compatibility table. See the verified location section of the Capacitor SDK reference.

iOS

Install the iOS plugin

Add both packages with Swift Package Manager. In Xcode, add a package dependency for each repository URL, or declare them in Package.swift:
Package.swift
Starting with iOS SDK 3.44.0, verified requests encrypt the complete request body, and the core SDK and plugin must be updated together. If payload preparation or encryption fails, the request stops and isn’t sent unencrypted.

Initialize the SDK on iOS

Initialize the core SDK as usual. The plugin needs no separate initialization.
Starting with iOS SDK 3.45.0, Radar.trackVerified() retries against a secondary host when the primary host doesn’t return a response from Radar. To turn this off, set trackVerifiedAutoFailover to false:
In earlier versions the default is false, and you set it to true to turn failover on.

Configure App Attest

App Attest supports the compromised flag on iOS.
  1. Enable App Attest for your app.
  2. Under Fraud on the Settings page, enter your valid App IDs as a comma-separated list, for example A1B2C3D4E5.com.example.app1,A1B2C3D4E5.com.example.app2.
If App Attest indicates that the device or app is compromised, user.fraud.compromised is true. If Radar.trackVerified() returns ERROR_FORBIDDEN, check the SDK logs.

Configure SSL pinning on iOS

To pin the certificates for Radar’s verified hosts, add the following to your Info.plist. Include the api-verified.radar.com entry when automatic failover is on.
Info.plist
See identity pinning on iOS.

Android

Install the Android plugin

Add the core SDK, the plugin, and the Play Integrity API to the dependencies section of your app’s build.gradle file:
build.gradle
The plugin compiles against the Play Integrity API and doesn’t bundle it, so add that dependency before you call Radar.trackVerified().

Initialize the SDK on Android

Pass fraud = true in RadarInitializeOptions. This is required for the sharing flag on Android.
Starting with Android SDK 4.2.0, Radar.trackVerified() retries against a secondary host when the primary host doesn’t return a response from Radar. To turn this off, pass trackVerifiedAutoFailover = false in RadarInitializeOptions. In earlier versions, pass trackVerifiedAutoFailover = true to turn failover on.

Configure the Play Integrity API

The Play Integrity API supports the compromised flag on Android. Enable the Play Integrity API under Fraud on the Settings page. If the device or app doesn’t meet basic integrity checks, user.fraud.compromised is true. If Radar.trackVerified() returns ERROR_FORBIDDEN, check the SDK logs. The Google Play services version on the device may be out of date.

Configure SSL pinning on Android

To pin the certificates for Radar’s verified hosts, add a res/xml/network_security_config.xml file. Include the api-verified.radar.com entry when automatic failover is on.
network_security_config.xml
Then reference the file from the application element in your manifest:
AndroidManifest.xml
If your debug builds load JavaScript from a local development server, as React Native does, add a separate domain-config that permits cleartext traffic to localhost. See Network Security Configuration on Android.

Web

Install the web plugin

With npm, install the core SDK and the plugin:
Then register the plugin before you initialize:
With script tags, load the plugin after the core SDK. The plugin bundle registers itself.
The plugin’s methods are on Radar.fraud, for example Radar.fraud.trackVerified(). The same methods on Radar, such as Radar.trackVerified(), still work and are deprecated.

Companion app and no-download paths

By default, the web plugin runs a check through the Radar Verify companion app on the user’s computer. Pass skipVerifyApp: true to run the check in the browser instead, with nothing for the user to install. To decide which path fits your product, and for download links, see Choose the companion app or the no-download path. To customize the Radar Verify installer or branding, contact your Radar account team.

Web plugin methods

The plugin adds these methods on Radar.fraud. The sections below give the parameters and defaults of each verified location method. Radar.fraud.errors holds the plugin’s error classes, such as Radar.fraud.errors.RadarVerifyAppError. The deprecated aliases on Radar cover trackVerified(), startTrackingVerified(), stopTrackingVerified(), getVerifiedLocationToken(), clearVerifiedLocationToken(), setExpectedJurisdiction(), and onTokenUpdated(). The other methods are on Radar.fraud only.

Radar.fraud.trackVerified()

Runs one verified location check and resolves with the geolocation token and the client result.
The check also sends the product set with Radar.setProduct() and the values set with Radar.fraud.setExpectedJurisdiction() and Radar.fraud.setExpectedAddress(). The promise resolves with these fields: When the check can’t complete, the promise rejects and there is no token. The error’s status has the reason. On the companion app path, the error is a RadarVerifyAppError with the status ERROR_VERIFY_APP when the app isn’t running. Each completed check becomes the last token that Radar.fraud.getVerifiedLocationToken() returns, and is passed to the callback registered with Radar.fraud.onTokenUpdated(). This example runs a check in the browser and sends a passing token to your backend. sendTokenToBackend, showFailure, and showCheckError are functions you write.

Radar.fraud.startTrackingVerified()

Starts automatic checks. If the last token is still valid, the first check is scheduled from it. Otherwise a check runs immediately.
The next check runs 10 seconds before the interval ends or the last token expires, whichever is sooner, and never less than 10 seconds after the previous one. Automatic checks don’t send a reason or a transactionId. A check that fails with an error is logged, not thrown, and the next check is still scheduled. To stop automatic checks, call Radar.fraud.stopTrackingVerified().

Radar.fraud.onTokenUpdated()

Registers one callback that receives the result of every completed check, whether you ran it with Radar.fraud.trackVerified() or the plugin ran it automatically. The argument has the same fields as the Radar.fraud.trackVerified() result. Registering a second callback replaces the first.

Radar.fraud.getVerifiedLocationToken()

Returns the last token when it passed and hasn’t expired. Otherwise it runs a new check with Radar.fraud.trackVerified() and returns that result, so it rejects with the same errors. It takes the same options as Radar.fraud.trackVerified(), which apply only when a new check runs.

Radar.fraud.clearVerifiedLocationToken()

Clears the last token, so that the next Radar.fraud.getVerifiedLocationToken() call runs a new check. Call it after you change the product with Radar.setProduct() or the expected jurisdiction, because the last token was issued for the earlier values.

Radar.fraud.onIpChanged()

Registers a callback, with no arguments, that the plugin calls when the device IP address changes. While a callback is registered, the plugin checks the IP address every 30 seconds. When the address changes, the plugin clears the last token and then calls the callback. Pass null to remove the callback.

Radar.fraud.setExpectedJurisdiction()

Sets the country code and state code you expect the user to be in. Later checks send both values, and a check in a different jurisdiction fails with country_not_expected or state_not_expected. See Failure and warning reasons. Call it with no arguments to clear both values.

Radar.fraud.setExpectedAddress()

Sets the address you expect the user to be at, as a string. Later checks send it, and the token reports the result in the expected address fields. Call it with no arguments to clear it.

Desktop

For desktop web apps, use the web plugin with the Radar Verify companion app described in Web. For native desktop apps, a Mac SDK (macOS 12.4 or later), a Windows SDK (Windows 10 or later with .NET 8 or later), and an Electron plugin are available on request. Contact your Radar account team for access. For how their calls differ from the mobile and web SDKs, see Desktop apps.

React Native

Install the React Native plugin

react-native-radar bundles a compatible iOS plugin. On Android, add the plugin version from the compatibility table.
Set iosFraud and androidFraud in the react-native-radar plugin options in app.json, then run npx expo prebuild --clean.
app.json
The Expo plugin adds io.radar:sdk-fraud and the Play Integrity API dependency to android/app/build.gradle only when they aren’t already there, and it configures SSL pinning for api-verified.radar.io only. It doesn’t add the api-verified.radar.com entry used for automatic failover. After prebuild, open android/app/build.gradle and confirm that the io.radar:sdk-fraud version matches the compatibility table. Update it if it is older.

Initialize the SDK on React Native

Pass true as the second argument to Radar.initialize() to turn on fraud detection. This is required for the sharing flag on Android.
To set automatic failover explicitly, pass trackVerifiedAutoFailover in the options argument (React Native SDK 4.38.0 or later):
Complete the App Attest and Play Integrity API steps for the native platforms.

Authenticate the SDK with auth tokens

Auth tokens must be enabled for your project. Contact your Radar account team.
Instead of a publishable key, you can initialize the SDK with a short-lived auth token. An auth token is a JSON Web Token (JWT) that your backend signs with a private key that only you hold. Radar verifies each request against the matching public key, which you register in the dashboard. For who can manage public keys, see Use auth tokens instead of a publishable key. Auth tokens need iOS SDK 3.28.0 or later, Android SDK 3.27.0 or later, or web SDK 5.1.0 or later.
1

Create a key pair

On your backend, create an EC P-256 key pair:
Store private-key.pem in your secret manager. Radar also accepts an RSA public key of 2048 bits or more, and tokens for that key are signed with RS256.
2

Register the public key

On the Settings page, under Auth tokens, click Add. Enter a Name, select the Environment (Test or Live), paste the full contents of public-key.pem into Public key, including the BEGIN and END lines, and click Add.The key appears in the list with the status Enabled. Copy its Key ID. Tokens signed for this key authenticate to the environment you selected.
3

Sign a token on your backend

Sign a JWT with the private key, and put the Key ID in the kid header. This Node.js example uses the jose package and reads the private key PEM and the Key ID from environment variables:
Node.js
Return the token to your app from an endpoint that requires your own user session.
4

Initialize the SDK with the token

Pass the token in place of the publishable key:
To check the setup, call Radar.trackVerified() (Radar.fraud.trackVerified() on web) and confirm that it returns a success status.

Token format

Each constraint you set must match the value the SDK sends with a location update:

Auth token errors

Verify the setup

  1. Build and run the app on a physical device, or open the page in a browser, using a test publishable key.
  2. Grant location permission.
  3. Call Radar.trackVerified() (Radar.fraud.trackVerified() on web).
  4. Confirm that the call returns a success status and a token whose token field is a non-empty string.

Supported clients

These clients can run a verified location check. The method column gives the form that takes every option. The Flutter, Cordova, and .NET MAUI SDKs expose earlier verified location methods that don’t accept reason or transactionId. See the verified location section of the Flutter SDK, Cordova SDK, or .NET MAUI SDK reference. The Capacitor SDK includes its own fraud plugins, as described in Compatibility. The Mac and Windows SDKs are covered in Desktop apps. For every native method signature, the token object, and the delegate or receiver, see the verified location section of the iOS SDK, Android SDK, React Native SDK, or Capacitor SDK reference. For web, see Web plugin methods.

Request parameters

A verified location check takes these parameters. All of them are optional. On web, Radar.fraud.trackVerified() also accepts userId, description, and metadata. See Web plugin methods. The user, product, and expected location aren’t parameters of the check on mobile and web. Set them before the check: The Mac and Windows SDKs take the publishable key, user ID, product, and expected jurisdiction as parameters of each call. See Desktop apps.

Manual and automatic checks

There are two ways to run checks. Backend validation is the same for both. On web, these methods are on Radar.fraud, and automatic checks respond to IP address changes only when you pass ipChanges: true. You can combine the two modes: run automatic checks for the session, and call Radar.trackVerified() with a reason and a transactionId before a single-use action. With automatic checks, call Radar.clearVerifiedLocationToken() (Radar.fraud.clearVerifiedLocationToken() on web) after you change the product with Radar.setProduct(), so that the next call returns a token for the new product. A manual integration follows three rules:
  • Reuse the token until it expires: Each token carries its own expiry in expiresAt, and tokens issued close to a border expire sooner. Compare the current time to expiresAt instead of using a fixed interval. See Expiry.
  • Check again on expiry or IP change: Run a new check when the token has expired or the SDK reports that the device IP address changed.
  • Run one check at a time: If a check is in progress when another is triggered, wait for the first result instead of starting a second request.
The SDK reports an IP address change through a callback: There is no separate callback for a location change. Movement toward a border is handled by the shorter expiry on the token. These examples apply the three rules in one function, checkLocation, that you call before each restricted action and when the app returns to the foreground. sendTokenToBackend, showFailure, and showCheckError are functions you write.
For a single-use action such as a withdrawal, call Radar.trackVerified() directly with a transactionId instead of reusing the last token. Your backend enforces the expiry on every restricted request. See Validate a token.

Zones and beacons

Radar evaluates the location against your allowed countries and states, and against the zones below. Each zone result is in the token’s country and state fields, and a failed zone test adds a value to failureReasons. See Failure and warning reasons.
Buffer zones and exclusion zones must be enabled for your project. Contact your Radar account team.
  • Buffer zones: A buffer zone fails a check that is too close to a border, based on a jurisdiction threshold or the accuracy reported by the device. The token sets user.state.inBufferZone and user.state.distanceToBorder, and the failure reason is state_in_buffer_zone.
  • Exclusion zones: An exclusion zone fails a check inside a zone within an otherwise allowed state. Exclusion zones can be turned on for all states or for specific states, under Fraud on the Settings page. The token sets user.state.inExclusionZone, and the failure reason is state_in_exclusion_zone.
  • Inclusion zones: An inclusion zone lets a check inside it pass the allowed-state test. The token sets user.state.inInclusionZone.
  • Custom geofence zones: To fail or pass checks inside a property, create a custom geofence on the Geofences page and set its fraud zone type to a state exclusion zone or a state inclusion zone. The geofence takes effect for checks made after you save it, and it appears in user.geofences. Geofences without a zone type don’t change passed.
A state check passes when the state matches the expected jurisdiction if you set one, the location isn’t in an exclusion zone, the location isn’t in a buffer zone, and the state is allowed or the location is in an inclusion zone. On iOS and Android, a check can also range nearby beacons. Pass beacons: true to Radar.trackVerified(). When beacons are enabled for your project, the beacons in range are returned with the user in the verified payload. A beacon doesn’t change passed, so if your rule depends on being near a beacon, apply it on your backend after you validate the token. For beacon setup and ranging, see Track indoor location with beacons.

Desktop apps

A native macOS or Windows app runs the check itself with the Mac or Windows SDK, without the web SDK or the companion app. The desktop SDKs differ from the mobile and web SDKs in three ways:
  • Call setup first: Call RadarVerify.setup() on macOS, or Radar.Setup() on Windows (using RadarVerify;), once at launch before the first check. On macOS it requests location permission, on Windows it checks it, and on both it warms up location services.
  • Pass identity on each call: There is no separate initialize, setUserId(), or setProduct() call. Pass the publishable key, user ID, and product to each RadarVerify.trackVerified(...) call on macOS, or Radar.TrackVerified() call on Windows.
  • Read a status and a token: The result is a status and a token. The token has token, passed, failureReasons, expiresAt, and expiresIn. A status other than success means the check didn’t complete and there is no token.
Both SDKs take the same parameters: Your backend validates a desktop token the same way as any other. For the complete macOS and Windows examples, see Verify from a native desktop app.

See also