Access Token Based Authentication is the default device authentication type. Once the device is created in ThingsBoard, the default access token is generated. It can be changed afterwards.
In order to connect the device to a server using Access Token based authentication, the client must specify the access token as part of CoAP request URL.
See CoAP API for more details.
CoAP AccessToken based authentication over DTLS is a standard authentication mode, where your client device verifies the identity of a server using server certificate.
In order to run CoAP AccessToken based authentication over DTLS, the server certificate chain should be signed by authorized CA or client must import the self-signed server certificate (.cer or .pem) to its trust store.
Otherwise, a connection will fail with the ‘Unknown CA’ error.
The coap-client example below demonstrates how to connect to ThingsBoard Cloud or to any other ThingsBoard CoAP server that has valid and trusted certificate.
Connect DTLS CoAP Client using access token
Install the CoAP client with DTLS support on Linux by following the next steps:
-B 3600 - Break operation after waiting given seconds;
-s 3600 - Subscribe to / Observe resource for given duration in seconds.
Don’t forget to replace coap.eu.thingsboard.cloud with the host of your ThingsBoard instance and YOUR_ACCESS_TOKEN with the access token of your device.
We use cookies to improve user experience. By continuing to browse this site, you agree the use of cookies, in accordance with our cookie policy.