Written by Andrew Pasika
The Kaa IoT platform supports token-based authentication for device-to-platform communication for MQTT and HTTP transports.
Each device is issued a unique token that serves as a credential for authenticating with the Kaa IoT platform.
This approach provides a simple yet secure way of device authentication.
Token-based authentication is always enabled and serves both for authentication and identification of the device by the platform.
Throughout Kaa documentation, this token is usually referred to as the endpoint token.
The token value can be either auto-generated by the platform or manually specified during device provisioning.
A token can be in one of the following states:
You can transition a token’s status using the “Endpoint Token Status” widget on the Device page.
In the MQTT transport, the endpoint passes the token in the MQTT topic.
Below is an example of data collection using mosquitto_pub
, where $ENDPOINT_TOKEN
is an environment variable holding the token value.
mosquitto_pub -h mqtt.cloud.kaaiot.com -t kp1/$APP_VERSION/dcx/$ENDPOINT_TOKEN/json/1 -m '{
"temperature": 21
}'
See MQTT device API for more examples.
In the HTTP transport, the endpoint passes the token in the URL.
Below is an example of data collection using curl
, where $ENDPOINT_TOKEN
is an environment variable holding the token value.
curl -X POST https://cloud.kaaiot.com/kpc/kp1/$APP_VERSION/dcx/$ENDPOINT_TOKEN/json --data '{"temperature": 21}'
See HTTP device API for more examples.