The Realer API authenticates device requests with OAuth 2.0 Client Credentials Grant.
Control devices exchange their API keys for a Bearer access token, then use that token on protected iot/v1 requests.
The Realer API keys used to authenticate control device requests are client_id and client_secret, which must be provided via HTTP Basic Authentication. You can view and manage your control device API keys in the Realer Dashboard when you are signed in as a user. If you do not have control device API keys, you can get them.
Your client credentials can issue device access tokens, so be sure to keep them secure. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
iot/v1 device requests as Authorization: Bearer <access_token>.
curl "https://api.therealer.com/oauth/token" \
-X POST \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' \
--data 'grant_type=client_credentials&scope=iot:catalog:read%20iot:feed-data:write'
Authenticate a registered control device with OAuth 2.0 Client Credentials Grant and obtain an access token for subsequent device API requests.
Base64 encoding of client_id and client_secret (API keys) joined by a single colon ":" of the control device that needs to be authenticated.
Control-device client_id values begin with cdv_ and contain 30 characters.
Type: String
Example: Basic QWxhZGRpbjpPcGVuU2VzYW1l
Must be client_credentials.
Type: String
Requested device API scopes. Supported scopes are iot:catalog:read and iot:feed-data:write.
If omitted, the token receives both scopes.
Type: Space-separated string
| Code | Description |
|---|---|
| 200 |
OK (Success) Example value (application/json)
From the successful token response, the authenticated device receives the access token required for subsequent API calls.
Retrieve command and sensor catalogs through the device catalog endpoints, then send measurements and acknowledgements through feed-data ingestion.
Subscription and plan checks are enforced on the protected
iot/v1 resources.
Use the
renew_after value to start renewal before the access token expires.
If the access token expires before renewal succeeds, authenticate again with the same OAuth token endpoint and grant_type=client_credentials.
|
| 400 |
Bad Request (Client Error) Example value (application/json)
|
| 401 |
Unauthorized (Client Error) Example value (application/json)
|
expires_in and start renewal after renew_after seconds.
By default, OAuth access tokens expire after 3600 seconds.
The default renewal hint is 2700 seconds.
The control device obtains a new access token by executing a new Client Credentials token request.
If renewal cannot complete, the device should keep or enter its local safe behavior until cloud authorization is restored.