Device Risk

Alloy's SDK supports Socure's Device Risk product.

Complete the following steps to start collecting device data to send to Alloy -

  1. Add the following optional parameter to your init params
    socurePublicToken: ‘string’
  2. Run alloy.init(input params) to return the Socure Device ID
  3. Next, there's two options:
    1. Run alloy.createJourney(journeyData, sandbox/prod) to automatically inject the Socure Device ID into the Journey payload
    2. Or alternatively, you can create the Journey yourself and pass in the socure_device_id you received from step 2
  4. Run alloy.open(callback, target) to trigger the SDK

Set Up

First, install the web SDK npm package:

yarn add @alloyidentity/web-sdk

or 

npm install @alloyidentity/web-sdk

Initialization Parameters

key: string; // client specific SDK key that is tied to your Alloy API Key/Secret. Can only be used to run the SDK
production?: boolean; // setting this to true will make the SDK use the Alloy production endpoints
journeyToken: string // Token that refers to that particular journey. ONLY IF USING A JOURNEY
isNext: true
socurePublicToken?: string // Pull device risk data via Socure

Quick Start Code

import React from 'react';
import alloy from '@alloyidentity/web-sdk'
import './App.css';

function App() {
  const alloyInitParams = {
    key: 'xyz',
    socurePublicToken: 'xyz',
    journeyToken: 'J-xyz',
    isNext: true,
  };

  const callback =(data: any) => {
    console.log(data);
  };

  const onClick = () => {
    alloy.createJourneyApplication({
      do_await_additional_entities: false,
      entities: [
        {
          "branch_name": "persons",
          "entity_type": "person",
          "data": {
            "name_first": "Drona",
            "name_last": "Beadnall"
          }
        }
      ],
    });
 };

  const onOpen = () => {
     alloy.open(callback, 'renderComponent');
  };

  alloy.init(alloyInitParams)

  return (
    <div className="App">
       <button onClick={onClick}>1. Create Application</button>
      <button onClick={onOpen}>2. Open</button>
      <div id="renderComponent">
      </div>
    </div>
  );
}

export default App;