To authenticate to ClearBlade IoT Core, each device must prepare a JSON Web Token (JWT, RFC 7519). JWTs are used for short-lived authentication between devices and the MQTT or HTTP bridges bridge. This page describes the ClearBlade IoT Core requirements for the JWT’s contents.
...
ClearBlade IoT Core requires these reserved claim fields. They may appear in any order in the claim set.
Name | Description | Required for |
---|---|---|
| Issued at: The timestamp when the token was created, specified as seconds since 00:00:00 UTC, January 1, 1970. The server may report an error if this timestamp is too far in the past or future (allowing 10 minutes for skew). | MQTT, HTTP |
| Expiration: The timestamp when the token stops being valid, specified as seconds since 00:00:00 UTC, January 1, 1970. The token’s maximum lifetime is 24 hours + skew.
| MQTT, HTTP |
| Audience: This must be a single string containing the cloud project ID where the device is registered. The authentication will only be allowed with further analysis if the connection request matches this project ID. | MQTT |
| System key: This must be a single string containing the ClearBlade registry’s system key. This can be obtained by clicking the API keys button (key icon) at the top-right of the ClearBlade Registry Details page. | HTTP |
| User ID: This must be a single string containing the deviceId. | HTTP |
| User type: This must be an integer hard-coded to value 3. | HTTP |
The nbf
(not before) claim will be ignored and is optional.
...
The JSON Web Signature (JWS) specification guides the mechanics of generating the JWT signature generation mechanics. The signature’s input is this content’s byte array:
...
To compute the signature, sign the base64url-encoded header, base64-url encoded claim set, and a secret key (such as a rsa_private.pem
file) using the algorithm you defined in the header. The signature is then base64url-encoded, and the result is resulting in the JWT. This example shows a JWT before base64url encoding:
...