Detect risk in customer interactions on digital channels, and enable informed identity and trust decisions across the consumer experience.
The React Native Detection and Response SDK Wrapper is a versatile tool designed to seamlessly integrate the powerful capabilities of the Detection and Response services into your React Native applications. By encapsulating the APIs of the native SDKs for both iOS and Android platforms, this wrapper empowers enterprises to confidently enhance security measures while maintaining a smooth user experience.
Using this module, you can easily integrate our Account Protection SDK into your React Native app.
Learn more on our website.
We recommended that you read more about the native Account Protection SDKs as described in our iOS documentation and Android documentation
To integrate this module, you'll need to configure an application in our portal.
- In your project, navigate to
example/src/config.tsand configure the clientId and secret using the configuration obtained from the Transmit portal. - Ensure you have all the necessary dependencies by running
yarnin both the module's root folder and the example root folder. - Run the example app on a real device using Xcode or Android Studio. Alternatively, execute
yarn example iosoryarn example android.
Important Security Note: Never store your
secretin a front-end application.The example app utilizes a mock server to manage communication with the authentication platform. This mock server employs the
secretyou have specified inexample/src/config.tsexclusively for demonstration purposes. It is paramount that you safeguard yoursecretin a secure and confidential location.
npm install react-native-ts-accountprotectionYou might need to execute pod install in your project's /ios folder.
Add to app/build.gradle under repositories
repositories {
google()
maven {
url('https://transmit.jfrog.io/artifactory/transmit-security-gradle-release-local/')
}
}
dependencies {
implementation("com.ts.sdk:accountprotection:2.1.+")
}First, update your strings.xml by adding
<resources>
<!-- Transmit Security Credentials -->
<string name="transmit_security_client_id">"CLIENT_ID"</string>
<string name="transmit_security_base_url">https://api.transmitsecurity.io/</string>
</resources>Next open your MainApplication.kt file in your React Native android project, and add:
class Application : Application() {
override fun onCreate() {
super.onCreate()
TSAccountProtection.initializeSDK(this.applicationContext) // initialize the SDK
...
}
}First, Create a filed named TransmitSecurity.plist in your native iOS Xcode project:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>credentials</key>
<dict>
<key>baseUrl</key>
<string>https://api.transmitsecurity.io/</string>
<key>clientId</key>
<string>[CLIENT_ID]</string>
</dict>
</dict>
</plist>Next initialize the SDK whe your app component is ready
import TSAccountProtectionSDKModule, { TSAccountProtectionSDK } from 'react-native-ts-accountprotection';
componentDidMount(): void {
// Setup the module as soon your component is ready
await TSAccountProtectionSDKModule.initializeSDK();
}await TSAccountProtectionSDKModule.setUserId(username);private handleTriggerActionLoginExample = async () => {
const triggerActionResponse = await TSAccountProtectionSDKModule.triggerAction(
TSAccountProtectionSDK.TSAction.login,
{
correlationId: "CORRELATION_ID",
claimUserId: "CLAIM_USER_ID",
referenceUserId: "REFERENCE_USER_ID",
transactionData: undefined
}
)
const actionToken = triggerActionResponse.actionToken;
console.log("Action Token: ", actionToken); // Use the action token to invoke the recommendation API.
}await TSAccountProtectionSDKModule.clearUser();Please take note that the example application uses a client-side mock server. In a production environment, a real server is required. Additionally, it is crucial to emphasize that storing the client secret in your front-end application is strictly discouraged for security reasons.
Transmit Security, https://github.com/TransmitSecurity
This project is licensed under the MIT license. See the LICENSE file for more info.