Getting TOTP key
To securely control device with TOTP protocol authentication, you need to know the key, which is a sequence of 16 bytes. It’s generated by the cloud at the first connection and every time you bind to the account.
- You can get it through the server API only in 2 steps:
get the authorization token for the required account
get a list of devices with parameters linked to this account
Getting list of device
GET https://my.hmarex.com/api/device/ –header «Authorization: Token
access_token
- Parameters
access_token
- authorization token in header
Answer:
{ "count": 4, "next": null, "previous": null, "results": [ { "id": 18801, "sn": "1100150010434B58363539XXXXXXXX", "name": "Room1", "":"" "totp_key": "BW4ERXAJXXXXXXXX" } ] }
Field totp_key
in parameters of every devices has required key for TOTP token generation.
Example:
{ GET /api/device/ HTTP/1.1 Host: my.hmarex.com Accept-Language: en Content-Type: application/json Authorization: Token 9573e6a8e24b025fafbaf81dc2eccbc09b94d187 }