Obtain device token
This endpoint can be used to acquire or refresh a device token. The initial acquisition requires the device_code parameter to be provided. The refresh operation requires a refresh token to be provided.
Endpoint is available at /token
relative path. This endpoint requires a signature header to be always present.
Initial device token acquisition
Parameters:
client_id
: unique client IDclient_secret
: API keygrant_type
: device_codedevice_code
: the device code acquired via registration call
Return value:
The Error
object if error occurred, otherwise DeviceToken
JSON object which has the following structure:
{
"token_type": "Bearer",
"expires_in": NNN,
"access_token": "xxx",
"refresh_token": "yyy"
}
Where token_type is always “Bearer”, expires_in is an access token expiration time in seconds, access_token is an access token which must be provided in the call to the public API login function, refresh_token is the token used to refresh the device token.
Device token refresh
Parameters:
client_id
: unique client IDclient_secret
: API keygrant_type
: refresh_tokenrefresh_token
: the refresh token
Return value:
The Error
object if error occurred, otherwise a new DeviceToken
JSON object. Refresh token may only be used once.
authorization_pending
error is returned the client should keep polling the endpoint until the token is acquired or some other error is returned.