Using sos.authHash
for Device Identification and Pairing
Introduction
The sos.authHash
is an alternative device identifier designed for secure pairing and locating devices through the REST API. For security reasons, we do not expose the DUID and UID of devices to Applet on device. Instead, you can obtain the authHash
identifier, which can then be used to find devices via the REST API.
- The
authHash
is commonly used as a link between the Applet deployed on the device and the device in device management. - The
authHash
is unique and can be revoked upon request. - The
authHash
can be used as a universal identifier for your Applet application.
How to Use sos.authHash
Obtaining authHash
within Applet
The authHash
can be retrieved from the JS SDK API - it's available as sos.authHash
.
async function startApplet() {
await sos.onReady();
console.log(sos.authHash);
}
window.addEventListener('sos.loaded', startApplet);
Get Device by authHash
on Server
To get device details using authHash
, make a GET request to the following endpoint:
GET /v1/device/authentication/{deviceAuthHash}
When you provide the correct authHash
, the API will respond with a 200
status code and a JSON object containing the deviceUid
.
With the deviceUid
, you can now call any endpoints that require deviceUid
.
Important Note
We have two similar endpoints, but they serve different purposes. The primary one you will use is the endpoint that converts authHash
to deviceUid
as described above. The other endpoint converts deviceUid
to authHash
, which is less commonly needed.
Summary
sos.authHash
is a secure alternative for device identification available within Applet context- Retrieve
authHash
from the JS SDK API -sos.authHash
. - Use the endpoint
/device/authentication/:authHash
to getdeviceUid
on server. - With
deviceUid
, you can access other device-specific endpoints.
For more detailed information, refer to the Get Device By AuthHash documentation.