Verify Signature Result

Last Updated on : 2024-06-20 06:27:10download

To improve service security, Tuya has updated the signature algorithm. This topic describes how to view the input parameters and decryption result of sign by using Postman. You can verify the encryption result of sign in the cloud API requests.

Prerequisites

Procedure

The API package provides scripts for calculating sign. You can use Postman’s console to print log parameters for verification.

  1. Add code to print console.log.
    In Postman, log in to the Pre-request Script page and find function calcSign. In the function, add the following code lines:

    // `str` is the input parameter of encryption
    console.log("str:",str);
    // `sign` indicates the encryption result
    console.log("sign:",signUp)
    

    Note: The verification calculation parameters of token requests (the APIs to get and refresh a token) are different from that of business requests (APIs other than the token management APIs). Select the correct API request calculation rule.

    Verify Signature Result

  2. Log in to the Console.

    Verify Signature Result

  3. Call APIs and view the returned result.

Example

Returned result of token requests

str:// the input parameter of encryption
xdkcpq**********qoj1630045879476GET
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

/v1.0/token?grant_type=1

sign: // the encryption result
A58C443B6015E*****AF6D3D36C5838E606A0BD6314B2*****853545

GET https://openapi-cn.wgine.com/v1.0/token?grant_type=1

Verify Signature Result

Returned result of business requests

str:// the input parameter of encryption
xdkcpq**********qojea33fd2de3f210db74236457729996831630046642548POST
ee962e19df3a7933efb0d6781a429d0f644ed5a1cd93d23ea3d13badde386d3b
	

/v1.0/devices/vde*******848877/commands

signUp:// the encryption result
8765D13****5FE027D7629D64F78560DAD*******D2DD7C18290715B2DA2

POST https://openapi-cn.wgine.com/v1.0/devices/vde*******848877/commands

Verify Signature Result