Radar.revealRisk(), and your backend will verify the signed result and read the risk level and the signals behind it.
Fraud detection and verified location checks are available on the Enterprise plan.
Quickstart: assess device and network risk
This is the whole client integration.sendRiskToken is the function you write that posts the token to your backend, or posts no token when the assessment didn’t complete.
requireSession and riskAssessments are your own session middleware and store.
Before you start
- The device and network risk assessment must be enabled for your project. Contact your Radar account team.
- Install the Radar SDK and the fraud plugin. See Fraud plugin setup.
Radar.revealRisk()requires iOS SDK 3.38.0 or later, Android SDK 3.35.0 or later,@radarlabs/plugin-fraud1.4.0 or later, or React Native SDK 4.36.0 or later. - Use a Test publishable key in your app. See Choose the right API key.
- Store your project’s JWT secret key, shown under Fraud on the Settings page of the Radar dashboard, in your backend’s secret manager.
Read the result
Radar.revealRisk() doesn’t request location permission and doesn’t need a user ID. It returns the assessment as an object and as a signed token that carries the same fields:
The assessment has no
passed field and no user ID. Your app decides what to do with it.
Validate the token on your backend
The token is a JSON Web Token signed withHS256 and your project’s JWT secret key, the same key that signs geolocation tokens. Its jti claim equals the assessment _id. Verify the signature and expiry before you read any field, as the backend example does.
The token says nothing about who is asking. Accept it only on a request you have already tied to a user or a registration attempt, record jti once, and treat a missing, invalid, or expired token as unknown risk, not as no risk.
To check your work, run the app with a Test publishable key and confirm that your backend responds with a riskLevel. Then change one character of the token and confirm a 400.
To use the assessment at login, registration, promotion redemption, or a payment, and to require a verified location check when the risk is elevated, see Assess risk and verify location.
Detect location spoofing, VPNs and proxies, screen sharing and remote control, and compromised devices and apps
A risk assessment reports device and network signals inrisk.reasons. A verified location check, Radar.trackVerified(), collects the same signals plus the device’s precise location. It needs location permission, carries the userId, and reports each family as a flag in user.fraud and as reasons in failureReasons or warningReasons.
For every reason, see Failure and warning reasons. Some reasons aren’t published, so handle values you don’t recognize without failing. The flags are defined in the Fraud object.
Understand risk scores and decisions
Radar reports what it observed, and your backend decides what your product does.- A risk level isn’t a probability of fraud. It ranks cases for attention, and a legitimate user can score high.
- There is no universal threshold. Choose what each level means for each action, and adjust it from recorded outcomes.
risk.levelon a risk assessment reflects the device and network signals in that assessment.user.fraud.riskon a verified location check is present when risk scores are enabled for your project. See Fraud fields.- A new device, several devices for one user, several users on one device, or a shared network is context, not proof. Households share devices, and offices put many people behind one IP address.
Configure rules and actions
Radar has two kinds of rules, both configured in the dashboard.- Block rules: Match one user ID, device ID, IP address, or MAC address, and fail every check for that value (Blocked) or pass every check for it (Bypassed). A blocked user fails verified location checks with
user.fraud.blockedset totrueand a failure reason such asfraud_blocked_user_id. To manage block rules from your backend, see the Fraud API. - Fraud rules: Match criteria on each location check, such as failure reasons, users for a device, or the check
reason. A rule can open a case, block the associated users, block the associated devices, or a combination.