The react-native-ts-accountprotection is a React Native module for Mosaic Fraud Prevention on Android and iOS.
When initialized, the module automatically starts collecting and submitting telemetry data to Mosaic—including information about the user journey, device data, and user interactions. Once specific user actions are performed on the client side (such as login), Fraud Prevention should be called to track those action events and obtain action tokens. The data collected can then be queried for recommendations using the Recommendations backend API.
Install the module from npm:
npm install react-native-ts-accountprotectionIn your app/build.gradle file, add the following:
repositories {
google()
maven {
url 'https://transmit.jfrog.io/artifactory/transmit-security-gradle-release-local/'
}
}
dependencies {
implementation "com.ts.sdk:accountprotection:3.+"
}Update your strings.xml file with your credentials:
<resources>
<string name="transmit_security_client_id">"CLIENT_ID"</string>
<string name="transmit_security_base_url">https://api.transmitsecurity.io/risk-collect/</string>
</resources>Use the appropriate base URL for your environment:
| Environment | Base URL |
|---|---|
| US | https://api.transmitsecurity.io/risk-collect/ |
| EU | https://api.eu.transmitsecurity.io/risk-collect/ |
| Canada | https://api.ca.transmitsecurity.io/risk-collect/ |
| Australia | https://api.au.transmitsecurity.io/risk-collect/ |
| Custom domain | https://<your_custom_domain>/risk-collect/ |
On Android, the SDK is initialized in the native layer. Open your MainApplication.kt file and add:
import com.transmit.accountprotection.TSAccountProtection
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
TSAccountProtection.initializeSDK(this.applicationContext)
}
}For a complete end-to-end integration walkthrough, see the React Native module quick start.