Show a QR code that lets users get access to the device.
These MQTT resources allow a device to generate a device token that can be used by a user to associate the device to his account. Token will be generated following policies defined at organization level on things5 such as if the token is single use or can be use multiple times and the role related to the token.
The user must use Device tokens consume to authorize the session
| Topic | Direction |
|---|---|
things5-production/v1/devices/{device_id}/req/generate_device_token_from_policies_req | Device → Things5 |
things5-production/v1/devices/{device_id}/req/generate_device_token_from_policies_res | Things5 → device |
Device → Things5: req/generate_device_token_from_policies_req
req/generate_device_token_from_policies_reqGiven a device and an organization use organization policies to generate a device token that will be returned as a QR code. Scanning the qr code will consume the token and associate the device to the user
things5-production/v1/devices/<device-id>/req/generate_device_token_from_policies_req
Payload
{
"request_id": "87049f68-696f-4be8-a6cc-bf827c04ed0e",
"type": "qr",
"things5_host": "myorganization.com",
"organization_id": "50867a80-c228-4db6-9fec-15bd72efc83a"
}
The request_id will be returned in the response. It can be used to match the request with the response. Should be random generated.
Payload Parameters
| name | description | example |
|---|---|---|
| request_id | the request id to be sent back by the device when sending the response | |
| type | type of response that will be sent. Qr is only type supported right now | |
| organization_id | the organization where the device | |
| things5_host | optional. If provided the qr code response will contain a url build using things5_host instead of text data. |
Things5 → device: req/generate_device_token_from_policies_res
req/generate_device_token_from_policies_resthings5-production/v1/devices/<device-id>/req/generate_device_token_from_policies_res
Payload
{
"data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=",
"errors": [],
"request_id": "87049f68-696f-4be8-a6cc-bf827c04ed0"
}
Payload Parameters
| type | description | example |
|---|---|---|
| data | data containing the session_id. if qr type was requested it's a base64 format string. Otherwise an encoded json | |
| request_id | The request id sent in the authentication_qr_req | 87049f68-696f-4be8-a6cc-bf827c04ed0e |
| errors | array of strings. |
