Token
How to retrieve a JWT (JSON Web Token) to authenticate on Cumulocity​
Overview​
In order to authenticate HTTP requests on Cumulocity, a device can retrieve a token using MQTT.
Retrieving the token​
Follow the below steps in order to retrieve the token from the Cumulocity cloud using MQTT.
-
Subscribe to token topic
- tedge
- mosquitto
- mqtt
tedge mqtt sub 'c8y/s/dat'
mosquitto_sub -t 'c8y/s/dat'
Subscribe: topicc8y/s/dat
-
Publish an empty message on
c8y/s/uat
topic- tedge
- mosquitto
- mqtt
tedge mqtt pub 'c8y/s/uat' ''
mosquitto_pub -t 'c8y/s/uat' -m ''
Publish topicc8y/s/uat
Payload<<empty>>
-
After a while the token will be published on the subscribed topic
c8y/s/dat
in the below format71,${Base64 encoded JWT}