nuǝW pǝuoᴉʇᴉsoԀ ʎlǝʌᴉʇɐƃǝN
Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

akamaibmp-cordova-plugin

2.1.4 • Public • Published

Akamai Bot Manager Premier Plugin for Cordova

Akamai Bot Manager Premier (BMP) plugin for Cordova is a service to detect traffic generated by bots. For more information please refer Akamai BMP developer website

Installation

Prerequisites

Akamai BMP plugin requires the following minimum versions for Android and iOS

  • Android API 15 (Android 4.0.4) and above
  • iOS version 8.0 and above

Adding the plugin

To add the Akamai BMP plugin to your Cordova app specify the npm package name akamaibmp-cordova-plugin of the plugin:

cordova plugin add akamaibmp-cordova-plugin

Updating the plugin

To update the Akamai BMP plugin to the latest released version easily via the following command:

cordova plugin update

Integration

The BMP SDK collects behavioral data while the user is interacting with the application. The behavioral data, also known as sensor data, includes the device characteristics, device orientation, accelerometer data, touch events, etc. Akamai BMP SDK provides a simple API to detect bot activities and defend against malicious bot and account takeover.

Collect Sensor Data

The BMP SDK’s sensor data contains serialized user behavioral data and device information. However, the device information doesn’t contain any information that will identify this device uniquely. You can retrieve sensor data from the plugin by calling the AkamaiBMP.getSensorData method. Sensor data should be sent in the REST API request as detailed below.

// Get the BMP sensor data
AkamaiBMP.getSensorData(function (sd) {
    // send the sensor data in the API request
    });

Send Sensor Data

After the sensor data is retrieved from the plugin, it should be sent in X-acf-sensor-data HTTP header as part your applications REST API (HTTP/S) request. We recommend using HTTPS for the REST API request to ensure the integrity of sensor data and prevent eavesdropping.

// Get the BMP sensor data
AkamaiBMP.getSensorData(function (sd) {
    // Set the sensor data header
    cordova.plugin.http.setHeader("X-acf-sensor-data", sd);
    });

Evaluate the Akamai Edge Response

Akamai edge server inspects sensor data and takes the predefined action on the request if the request is classified as BOT, otherwise Akamai sends the request to the origin server.

When the app makes a request, Akamai evaluates the sensor data at the edge. If the request is classified as human, the traffic continues to the origin server and the response is sent back to the app. If the request is BOT, there are two possible actions, monitor and deny.

  • If the action is monitor, the traffic is allowed and the request is sent to the origin server.
  • If the action is deny, a 403 HTTP response is sent back to the app, and the app should handle the situation and take appropriate action.

Logging

Akamai BMP plugin logs some messages at all log levels to verify the SDK initialization. These messages are helpful in identifying any integration issue and ensure the plugin is initialized successfully.

In addition to these messages, the plugin logs additional messages at info, warn and error levels, to verify and debug that the SDK is working correctly. The default log level for the plugin is set to log ​warning​ and ​error​ messages only.​ This behavior can be changed by calling setLogLevel API.

To set the log level, call AkamaiBMP.setLogLevel API with one of the log levels specified below:

  • AkamaiBMP.LOG_LEVEL_INFO - Print all messages
  • AkamaiBMP.LOG_LEVEL_WARN - (Default)​ Print warning and error messages only
  • AkamaiBMP.LOG_LEVEL_ERROR - Print error messages only
  • AkamaiBMP.LOG_LEVEL_NONE - Turn off all log messages from the SDK

For example, to see all messages:

// Set the log level to Info
AkamaiBMP.​setLogLevel(​AkamaiBMP.​INFO);

For further information please refer Akamai BMP SDK Documentation

install

npm i akamaibmp-cordova-plugin

Downloadsweekly downloads

20

version

2.1.4

license

ISC

last publish

collaborators

  • avatar
Report a vulnerability