fraud-protection-do-not-use v1.0.1
@microsoft/fraud-protection
Getting started
Install library
from
npm
npm install @microsoft/fraud-protection --save
from
yarn
yarn add @microsoft/fraud-protection
Link native code
With autolinking (react-native 0.60+)
cd ios && pod install
Pre 0.60
react-native link @microsoft/fraud-protection
Usage
You can initiate the SDK by following so it can start to collect device attributes.
import RNFraudProtection from '@microsoft/fraud-protection'; RNFraudProtection.start($tenantId);
In this code, tenantId is the globally unique identifier (GUID) or universally unique identifier (UUID) that is provided by Microsoft.
Send collected device attributes to Microsoft by calling send(). You can call send() in anywhere before or on the page that has the operation that you need a risk assessment for. For a sign-in/sign-up scenario, you can call send() immediately after start() call.
import RNFraudProtection from '@microsoft/fraud-protection'; RNFraudProtection.send($pageId); // Or RNFraudProtection.send()
In this code, pageId is optional and can be set in the following way, depending on the scenario:
- SI – Sign In
- SU – Sign Up
- P – Purchase
- tst – Test
Call getSessionId() to obtain the SessionId value that is required when the risk assessment APIs are called.
import RNFraudProtection from '@microsoft/fraud-protection'; RNFraudProtection.getSessionId((sessionId) => { console.log(sessionId) });
Runtime permissions
The React Native SDK relies on the following native runtime permissions to collect various device data. The SDK doesn't ask for any runtime permissions. The app should obtain these runtime permissions from the user.
Android
- android.permission.ACCESS_COARSE_LOCATION
- android.permission.READ_PHONE_STATE
- android.permission.BLUETOOTH_CONNECT
iOS
- The iOS SDK uses CLLocationManager, and checks for CLAuthorizationStatus.authorizedAlways or CLAuthorizationStatus.authorizedWhenInUse before it requests location data. The app should obtain CLLocationManager.requestWhenInUseAuthorization Or CLLocationManager.requestAlwaysAuthorization permission from the user.
- The iOS SDK uses AppTrackingTransparency and checks for ATTrackingManager.AuthorizationStatus.authorized before it collects AdvertisingId. The app should obtain ATTrackingManager.requestTrackingAuthorization permission from the user.
Support
To log a support ticket, go to https://dfp.microsoft.com. (Global admin permissions are required.)