{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition","tabs","tab"]},"redocly_category":"Guides","product":"Fraud Prevention","type":"markdown"},"seo":{"title":"Cordova plugin quick start","description":"Everything about Mosaic Journeys, SDKs, and APIs","siteUrl":"https://developer.transmitsecurity.com/","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"cordova-plugin-quick-start","__idx":0},"children":["Cordova plugin quick start"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide describes how to integrate Fraud Prevention into your Cordova application. It helps you set up the Mosaic Cordova plugin, enabling you to enhance your mobile applications' security with Fraud Prevention services."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Client-side integrations are recommended for POCs and testing. For production environments, consider implementing ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/risk/quick_start_backendapi"},"children":["Backend integration"]},". Learn more about integration options: ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/risk/integration_clientside_vs_backend"},"children":["Client-side integration vs Backend integration"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"how-it-works","__idx":1},"children":["How it works"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The flow starts with the user navigating to the app (1). The plugin gets initialized and starts sending telemetry to Mosaic (2). When a user performs an action, for example, clicks a login button (3), the plugin triggers an action event (4) and obtains an action token (5) which then forwards to the backend (6). Having received an action token, the application backend uses it to fetch recommendation from Mosaic (7 & 8) and instructs the client to act accordingly (9) in order to complete the login procedure (10). Upon successful login, the client sets the user (11)."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/drs-integrations.e8bd6c270c3421cd094a28293ef02bbedc1ec768e8b114e37ca9db8266381857.e95a590b.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"requirements","__idx":2},"children":["Requirements"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Cordova CLI 12.0 or higher (tested with cordova-ios 8.x and cordova-android 14.x)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["iOS 13.0 or higher, Xcode 16 or higher"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Android API level 24 (Android 7.0) or higher"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Node.js LTS"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"before-you-start","__idx":3},"children":["Before you start"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Before integrating, make sure you have:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Fraud Prevention enabled"]}," as the risk engine for your tenant. Identity Threat Protection and Fraud Prevention are mutually exclusive—contact your Customer Success Manager to enable the appropriate engine."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["An application with a service client"]}," in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://portal.transmitsecurity.io/"},"children":["Admin Portal"]},". The service client provides the client ID and secret used to authorize backend requests to Mosaic. If you don't have one yet, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/user/create_new_application/"},"children":["Create an application"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-1-install-the-plugin","__idx":4},"children":["Step 1: Install the plugin"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"badge-wrapper"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"className":"badge"},"children":["Client"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add the Mosaic Cordova plugin to your project from the published plugin repository:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"cd /path/to/your/cordova/app\n\n# Pinned to a release (recommended for production)\ncordova plugin add https://github.com/TransmitSecurity/cordova_ts_account_protection_plugin.git#v0.1.0\n\n# Add the platforms (first time only)\ncordova platform add ios android\n\n# Prepare the native projects\ncordova prepare ios android\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["On iOS, the plugin resolves the native Fraud Prevention SDK through Swift Package Manager, so you don't need to build native SDK sources in your app project. On Android, the plugin pulls the SDK from the Transmit Security Maven repository."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-2-configure-the-plugin","__idx":5},"children":["Step 2: Configure the plugin"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"badge-wrapper"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"className":"badge"},"children":["Client"]}]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"label":"Android","disable":false},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The plugin adds the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["INTERNET"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ACCESS_NETWORK_STATE"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ACCESS_FINE_LOCATION"]}," permissions to the manifest and resolves the Fraud Prevention SDK from the Transmit Security Maven repository. Ensure your app-level Gradle can resolve the repository (usually inherited from the Cordova Android project)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"update-stringsxml","__idx":6},"children":["Update strings.xml"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add your credentials to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["res/values/strings.xml"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"xml","header":{"controls":{"copy":{}}},"source":"<resources>\n    <!-- Mosaic Credentials -->\n    <string name=\"transmit_security_client_id\">[YOUR_CLIENT_ID]</string>\n    <string name=\"transmit_security_base_url\">https://api.transmitsecurity.io/risk-collect/</string>\n</resources>\n","lang":"xml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the appropriate base URL for your environment:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Environment"},"children":["Environment"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Base URL"},"children":["Base URL"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["US"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.transmitsecurity.io/risk-collect/"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["EU"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.eu.transmitsecurity.io/risk-collect/"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Canada"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.ca.transmitsecurity.io/risk-collect/"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Australia"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.au.transmitsecurity.io/risk-collect/"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Custom domain"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://<your_custom_domain>/risk-collect/"]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"div","attributes":{"label":"iOS","disable":false},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The native SDK is included via Swift Package Manager and is resolved by Xcode on the first build."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-transmitsecurityplist","__idx":7},"children":["Create TransmitSecurity.plist"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a file named ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransmitSecurity.plist"]}," and add it to your iOS app:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"xml","header":{"controls":{"copy":{}}},"source":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n    <key>credentials</key>\n    <dict>\n        <key>clientId</key>\n        <string>[CLIENT_ID]</string>\n        <key>baseUrl</key>\n        <string>https://api.transmitsecurity.io/risk-collect/</string>\n    </dict>\n</dict>\n</plist>\n","lang":"xml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To bundle the plist with your app, reference it in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["config.xml"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"xml","header":{"controls":{"copy":{}}},"source":"<platform name=\"ios\">\n    <preference name=\"deployment-target\" value=\"13.0\" />\n    <resource-file src=\"resources/ios/TransmitSecurity.plist\" target=\"TransmitSecurity.plist\" />\n</platform>\n","lang":"xml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the appropriate base URL for your environment:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Environment"},"children":["Environment"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Base URL"},"children":["Base URL"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["US"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.transmitsecurity.io/risk-collect/"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["EU"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.eu.transmitsecurity.io/risk-collect/"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Canada"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.ca.transmitsecurity.io/risk-collect/"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Australia"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.au.transmitsecurity.io/risk-collect/"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Custom domain"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://<your_custom_domain>/risk-collect/"]}]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-3-initialize-the-plugin","__idx":8},"children":["Step 3: Initialize the plugin"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"badge-wrapper"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"className":"badge"},"children":["Client"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The plugin exposes the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cordova.drs"]}," object once the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["deviceready"]}," event has fired. Initialize the plugin when your app starts, using the platform-specific configuration files created in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#step-2-configure-the-plugin"},"children":["Step 2"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"document.addEventListener('deviceready', function () {\n  cordova.drs.initializeSDK()\n    .then(function () {\n      console.log('Fraud Prevention SDK initialized');\n    })\n    .catch(function (err) {\n      console.error('Init failed', err);\n    });\n});\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Backend integration"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Start a plugin session and obtain a device session token after plugin initialization and prior to triggering events, and persist it on your backend. This step is optional for client-side integration but ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["strongly recommended"]}," as it allows you to transition to the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/risk/quick_start_backendapi"},"children":["backend integration"]},"—a device session token is needed to trigger events from the backend and binds the user's interactions to their device."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const sessionToken = await cordova.drs.getSessionToken();\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-4-collect-behavioral-data","__idx":9},"children":["Step 4: Collect behavioral data"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"badge-wrapper"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"className":"badge"},"children":["Client"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The plugin loads web telemetry on startup. It maps DOM widgets, tracks taps and touches, and reports navigation changes in the WebView, so no extra wiring is required for basic HTML apps."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If your app uses a custom SPA router and you want to report explicit page names, call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["logPageLoad()"]}," whenever the active route changes:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"cordova.drs.logPageLoad('Dashboard');\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-5-use-the-cordova-plugin","__idx":10},"children":["Step 5: Use the Cordova plugin"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"badge-wrapper"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"className":"badge"},"children":["Client"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The example below demonstrates triggering a login event from a login button, setting and clearing a user."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For an alternative approach that directly utilizes our backend API instead, refer to our ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/risk/quick_start_backendapi#step-4-trigger-actions"},"children":["Backend API implementation"]}," guide."]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["triggerAction()"]}," receives an action type and returns a response that includes the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["actionToken"]}," that you should pass to the backend. To obtain risk recommendations for sensitive actions, your application should report these actions. To do this, add the code below to relevant user interactions (such as the Login button ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["click"]}," event handler). The plugin allows reporting on events with specific action types. Replace ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[ACTION_TYPE]"]}," with the appropriate action type from our ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/risk/recommendations"},"children":["list of actions"]},"."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To improve Fraud Prevention, optionally pass the correlation ID, and claimed user ID and its type (for users that haven't authenticated yet)."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To report precise device location, add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["locationConfig"]}," to the call (the user has to consent to sharing location in advance, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/risk/report_geolocation"},"children":["Track geolocation"]},")."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["customAttributes"]}," is an optional object that adds context to an action but must match the schema defined in the Portal. Invalid attributes are ignored (see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/risk/action-attributes"},"children":["Custom attributes"]},")."]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["triggerAction()"]}," resolves with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{ success, actionToken }"]},". It does not throw when the SDK rejects the action, so check ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["success"]}," before using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["actionToken"]},"."]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"cordova.drs.triggerAction(\n  'login',\n  {\n    correlationId: 'login-' + Date.now(),\n    claimedUserId: '91e25bea0c...', // hashed email\n    claimedUserIdType: 'email'\n  },\n  { mode: 'default' }, // locationConfig (optional)\n  { userLevel: 'premium' } // customAttributes (optional)\n).then(function (result) {\n  if (result.success) {\n    console.log('Action Token:', result.actionToken);\n  } else {\n    console.log('Action failed or flagged');\n  }\n});\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["setAuthenticatedUser()"]}," sets the user context for all subsequent events for the session (or until the user is explicitly cleared). It should be called only after you've fully authenticated the user (including, for example, any 2FA that was required). On Android, call this after the WebView activity is visible. For the complete list of action types, see our ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/risk/recommendations#action-types"},"children":["recommendations"]}," page."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"await cordova.drs.setAuthenticatedUser('user-123', {\n  loginMethod: 'password',\n  email: 'user@example.com'\n});\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["clearUser()"]}," clears the user context for all subsequent events in the mobile session. The user gets automatically cleared once the session expires or in case of a login action."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"await cordova.drs.clearUser();\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["getSessionToken()"]}," returns a session token needed for triggering events from the backend."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const sessionToken = await cordova.drs.getSessionToken();\n","lang":"javascript"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-6-fetch-recommendations","__idx":11},"children":["Step 6: Fetch recommendations"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"badge-wrapper"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"className":"badge"},"children":["Backend"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can fetch recommendations for the reported action using the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/openapi/risk/recommendations.openapi/other/getriskrecommendation"},"children":["Recommendation API"]},". This is the same API that's also used for mobile integrations."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Mosaic APIs are authorized using an OAuth access token so you'll need to fetch a token using your service client credentials. To do this, send the following request:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const resp = await fetch(\n  `https://api.transmitsecurity.io/oidc/token`,\n  {\n    method: 'POST',\n    headers: {\n      'Content-Type': 'application/x-www-form-urlencoded'\n    },\n    body: new URLSearchParams({\n      grant_type: 'client_credentials',\n      client_id: '[CLIENT_ID]',\n      client_secret: '[CLIENT_SECRET]'\n    })\n  }\n);\nconst { access_token } = await resp.json();\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["From your backend, invoke the Recommendation API by sending a request like the one below. The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[ACCESS_TOKEN]"]}," is the authorization token you obtained using your client credentials and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[ACTION_TOKEN]"]}," is the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["actionToken"]}," received in Step 5."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const query = new URLSearchParams({\n  action_token: '[ACTION_TOKEN]',\n}).toString();\n\nconst resp = await fetch(\n  `https://api.transmitsecurity.io/risk/v1/recommendation?${query}`,\n  {\n    method: 'GET',\n    headers: {\n      Authorization: 'Bearer [ACCESS_TOKEN]',\n    },\n  }\n);\n","lang":"javascript"},"children":[]}]},"headings":[{"value":"Cordova plugin quick start","id":"cordova-plugin-quick-start","depth":1},{"value":"How it works","id":"how-it-works","depth":2},{"value":"Requirements","id":"requirements","depth":2},{"value":"Before you start","id":"before-you-start","depth":2},{"value":"Step 1: Install the plugin","id":"step-1-install-the-plugin","depth":2},{"value":"Step 2: Configure the plugin","id":"step-2-configure-the-plugin","depth":2},{"value":"Update strings.xml","id":"update-stringsxml","depth":3},{"value":"Create TransmitSecurity.plist","id":"create-transmitsecurityplist","depth":3},{"value":"Step 3: Initialize the plugin","id":"step-3-initialize-the-plugin","depth":2},{"value":"Step 4: Collect behavioral data","id":"step-4-collect-behavioral-data","depth":2},{"value":"Step 5: Use the Cordova plugin","id":"step-5-use-the-cordova-plugin","depth":2},{"value":"Step 6: Fetch recommendations","id":"step-6-fetch-recommendations","depth":2}],"frontmatter":{"markdown":{"toc":{"depth":2}},"seo":{"title":"Cordova plugin quick start"}},"lastModified":"2026-07-26T12:47:04.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/risk/quick_start_cordova","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}