English
English
简体中文
Register
Log In
English
English
简体中文
Register
Log In
Language
English
English
简体中文
Register
Log In

How to generate a signature in a call?

Last Updated on2023-01-30 09:52:46
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:
    1. client_idand the 13-digit standard timestamp of the specified request to create a string.
    2. secret. Encode the hash digest value into a new string.
    3. 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:
    1. client_idaccess_token, and the 13-digit standard timestamp of the specified request to create a string.
    2. secret. Encode the hash digest value into a new string.
    3. Capitalize all letters of the new string.

    Click for services and help

    Help Center