Configuration Options
The following options can be passed to the DeviceAssure.qr() method.
Core
| Parameter | Type | Default | Description |
licence | string | | Required. Your DeviceAssure licence key |
containerId | string | deviceassure-qr-container | ID of the container element for the QR code iframe |
callback | function | | Function called when a scan result is received |
Display
| Parameter | Type | Default | Description |
size | number | 250 | QR code size in pixels (min: 50, max: 500) |
json | boolean | false | When true, hides the iframe after scan and returns data via callback |
scannedMessage | string | Code was scanned | Message displayed after successful scan |
expiredMessage | string | Code has expired | Message displayed when QR code expires |
lifecycle | string | default | default: shows scanned message after scan. auto-refresh: automatically generates a new code once scanned |
responseDelay | number | 2000 | Delay in milliseconds after a scan before transitioning. Used with auto-refresh and redirect |
Redirects
| Parameter | Type | Default | Description |
redirect | string | | URL to redirect the host page after scan |
deviceRedirect | string | | URL to redirect the scanning device after scan |
destination | string | | Custom URL the QR code points to instead of the default DeviceAssure page. See Custom Destination example |
Additional Options
| Parameter | Type | Default | Description |
imei | string | | IMEI for additional device verification. Must be a non-empty string containing a valid IMEI. Requires a licence with IMEI enabled |
tags | array | [] | Custom tags returned in the API response. Each item is a {key, value} object. Key max 64, value max 128 characters |
Script
| Parameter | Type | Default | Description |
script.defer | boolean | false | Adds the defer attribute to the QR script tag |
script.async | boolean | false | Adds the async attribute to the QR script tag |
script.nonce | string | | Adds a nonce attribute for Content Security Policy compliance |
Example
DeviceAssure.qr({
containerId: 'deviceassure-qr-container',
licence: '<LICENCE_KEY>',
callback: function(result) {
console.log('Scan result:', result);
},
size: 300,
json: true,
scannedMessage: 'Device verified!',
expiredMessage: 'QR code expired - please refresh',
lifecycle: 'auto-refresh',
responseDelay: 3000
});
See Also
- Examples - Implementation examples for different scenarios
- Response Format - Understanding the response data
- Styling - Customise the QR code appearance