When you call an API operation of Tuya Cloud, you must provide a signature to verify your identity. This topic describes how to generate a signature in a call.
Signature algorithm
Tuya Smart uses HMAC-SHA256 to create a message digest. Different signature algorithms are used in the following types of API operations: token management operations and service management operations.
Signature algorithm for token management operations
- Scope of application: operations that are used to get or refresh tokens.
- Signature algorithm: sign = HMAC-SHA256(client_id + t, secret).toUpperCase()
- Procedure to sign a request:
- client_idand the 13-digit standard timestamp of the specified request to create a string.
- secret. Encode the hash digest value into a new string.
- Capitalize all letters of the new string.
Signature algorithm for service management operations
- Scope of application: operations that are used to manage services rather than tokens.
- Signature algorithm: sign = HMAC-SHA256(client_id + access_token + t, secret).toUpperCase()
- Procedure to sign a request:
- client_idaccess_token, and the 13-digit standard timestamp of the specified request to create a string.
- secret. Encode the hash digest value into a new string.
- Capitalize all letters of the new string.