Using device risk tags in the decision engine

更新时间:
复制 MD 格式

The decision engine includes a built-in integration for device risk control. To use device risk tags, obtain a deviceToken from the device risk control SDK and pass this token as an input parameter in your requests to the decision engine.

Add deviceToken to event fields

  1. Add deviceToken as an event field. The deviceToken is an encrypted string. When the decision engine receives a request that contains this token, it automatically parses the relevant device information to evaluate your risk control policies.

  2. Obtain the deviceToken parameter from the device risk control SDK. For details, see the documentation for Android and iOS. Your client application retrieves the token and sends it to your server, which then passes it to the decision engine with other event fields.

In Risk Detection > Event Management, open the edit page for the target event. In the Event Fields area, you can see the added deviceToken field. The field type is String, and the field source is System Default Field.

Create a policy

You can create targeted policies based on the risk that different tags represent. In this example, a policy triggers if the device risk tags contain is_emulator, which indicates the device is an emulator.

  1. Navigate to Policy Management to create a policy.

  2. Configure the policy logic:

    1. For the Left Variable, select the system variable Device Risk Identification_Tag.

  1. For the operator, select Contains Right Variable.

  2. For the Right Variable, enter the tag value is_emulator.

  1. To configure the policy output, set the Policy Output Tag's Type to Variable, and use the same variable as the Left Variable: Device Risk Identification_Tag.

Verification

  1. You can use the Risk Detection OpenAPI to verify the configured event. See the following examples.

  2. Sample request

{"eventCode":"de_example", "deviceToken":"***"}

  1. Sample response

    The response contains the is_emulator tag, which triggers the policy. Consequently, the decision engine returns the relevant device risk tags.

{
 "Message": "OK",
 "RequestId": "1E06CC74-1C69-5874-8A91-2C1FFD1D2EEF",
 "Data": {
 "tags": "is_rooted,is_emulator"
 },
 "Code": 200
}