Generate and Store Token
Generate a session token for a device in the Meshblu device registry.
Generate a session token for a device in the Meshblu device registry. In order to generate a token, your connection must be authenticated as a device that is in the target device's configure.update whitelist. See the Meshblu whitelist documentation for more information.
Event: "generateAndStoreToken", query, callback
"generateAndStoreToken", query, callbackqueryQuery object, must contain only theuuidproperty.uuidUUID of the device to generate a token for.
callbackFunction that will be called with aresult.resultObject passed to the callback. Contains either the (uuid,token,createdAt) triplet, orerrorkey, but never both.uuidThe uuid for which a token was generatedtokenThe token that was generated in plain-text form. This is the only time that token will ever be shown. If it is not saved at this point, it can never be retreivedcreatedAtAn ISO 8601 timestamp for when the token was generated.errorString explaining the what went wrong. Is only present if something went wrong.
Check the permissions
In order to generate a token, your connection must be authenticated as a device that is in the target device's
configure.updatewhitelist. See the Meshblu whitelist documentation for more information.
In Meshblu, it is not possible to distinguish between a device not existing and not having permission to view a device. In most of the Meshblu API calls, the error in both cases yields the protocol-specific equivalent of an
HTTP 404: Not Found. The Socket.IO API, however, returns the errorForbidden. This is for backwards compatibility and will likely change with the next major version release of the Socket.IO API.
Successful Response
When generateAndStoreToken is called for a valid device that the authorized device may update:
{
"uuid": "78159106-41ca-4022-95e8-2511695ce64c",
"createdAt": "2016-05-20T18:25:13.587Z",
"token": "8234f58b65ff042da60d84af4230d3692778ca5b"
}
Error Response
When generateAndStoreToken is called for a non-existing devices, or devices the authenticated device may not update:
{
"error": "Forbidden"
}
Updated less than a minute ago
