Skip to content

Sample Application

A sample application is included in the package. It includes examples for the following scenarios:

Type On Page Load On Event IMEI Corroboration
Client to Server
Server to Server
QR Code

The QR Code method also includes Redirect and Custom Scan URL examples. See Sample Application Pages for the full list.

A valid DeviceAssure licence key is required for the "Client to Server" examples as these will call the DeviceAssure API from the client.

To correctly identify an Android device or Desktop using the Chrome browser, or any browser that supports client-hints, data collection must occur over a secure context.


Running the Sample Application

Prerequisites

  • Node.js and npm installed on your machine (Node 22 or later is recommended)
  • A DeviceAssure licence key
  • (Optional) Docker installed on your machine

Setup

Unzip the package and navigate to the SampleApplication directory:

cd SampleApplication

Amend the env.js file to include your DeviceAssure licence key:

module.exports = {
  DEVICEASSURE_API_KEY: '<LICENCE_KEY>' // Replace with your DeviceAssure licence key
};

Install the required dependencies:

npm install

Start the web server:

npm start

The sample application will be available at http://localhost:8096 by default.


Running in Docker

Unzip the package and navigate to the SampleApplication directory:

cd SampleApplication

Add your DeviceAssure licence key in the env.js file as shown above.

Build the Docker image and run the container:

docker build -t deviceassure-sample-app .

docker run -p 8096:8096 --name deviceassure-sample-app deviceassure-sample-app

Sample Application Pages

The sample application includes the following example pages:

Page Location Description
src/pages/client-to-server/on-page-load Client to Server - Verify on page load
src/pages/client-to-server/on-event Client to Server - Verify on user action (e.g. button click)
src/pages/client-to-server/imei Client to Server - Verify with IMEI for additional device identification
src/pages/server-to-server/s2s Server to Server - Verify on page load
src/pages/server-to-server/s2s-event Server to Server - Verify on user action (e.g. button click)
src/pages/server-to-server/imei-s2s Server to Server - Verify with IMEI for additional device identification
src/pages/qr/qr QR Code - Verify on page load
src/pages/qr/qr-event QR Code - Verify on user action (e.g. button click)
src/pages/qr/qr-imei QR Code - Verify with IMEI for additional device identification
src/pages/qr/redirect QR Code - Redirect host and device based on verification result
src/pages/qr/custom-destination/qr-custom-destination QR Code - Custom scan URL
src/pages/qr/custom-destination/qr-custom-check QR Code - Custom scan URL (handler)

Framework Examples

Framework-specific examples are also included in the package:

Framework Directory Dev Server Port
Angular SampleApplication-angular/ 4200
React SampleApplication-react/ 3000
Vue SampleApplication-vue/ 5173

Each framework example includes Client to Server, Server to Server, and QR Code pages.

Note: The Server to Server and QR Code examples require the main SampleApplication backend running on port 8096.


See Also