05/15/2024 15:19:45

Problem description

The request backend interface error: "1008 invalid sig!"

Causes of the problem

sig calculation error

Solution

Calculate the correct sig according to the requirements of the document, and then splice it into the request string to solve the problem.

I. The sig calculation process

1. Confirm information
(1) The request interface, such as /v2/auth/verify_login
(2) What parameters are spliced ​​into the request URL (they must be sorted by the dictionary), such as channelid=2&conn=&gameid=12&os=1&seq=&source=1&ts=1642490127
(3) What input parameters does the request body has, such as {"openid":"16862533134614867973","token":"0AFC2484F0B48C9D70D501662B828F4A"}
(4) Determine the source value in the request URL, and obtain the corresponding sigkey value in Feiying System

Image description

2. Splice the original string of sig
Splice the determined information in the form of interface + "?" + params + body + sigkey.
For example, according to the information determined above, the following string can be spliced: /v2/auth/verify_login?channelid=2&conn=&gameid=12&os=1&seq=&source=1&ts=1642490127{"openid":"16862533134614867973","token":"0AFC2484F0B48C9D70D501662B828F4A"}itopsigkey123456

3. Perform MD5 encryption on the raw string of sig (32-bit lowercase)

For example, after performing MD5 encryption on "/v2/auth/verify_login?channelid=2&conn=&gameid=12&os=1&seq=&source=1&ts=1642490127{"openid":"16862533134614867973","token":"0AFC2484F0B48C9D70D501662B828F4A"}itopsigkey123456", we can get "451bb4ebfab7a436c53ab2c614e113ec"

Warning: In order to protect the security of the key value. "sigkey itopsigkey123456" in the example is fake data and has been replaced by the real value in Feiying System when MD5 is actually calculated.

4. Splice sig into the request in URL

(1) Request URL
https://hktest.itop.qq.com/v2/auth/verify_login?channelid=2&conn=&gameid=12&os=1&seq=&source=1&ts=1642490127&sig=451bb4ebfab7a436c53ab2c614e113ec
(2) Request Body
{"openid":"16862533134614867973","token":"0AFC2484F0B48C9D70D501662B828F4A"}
(3) Return
{"ret":0,"msg":"user is logged in.","seq":"1642491509-1932026121-030358-0313503990"}

Image description

II. Warning

1.After any data in the original string of sig is modified, it is needed to recalculate sig for request.
2.The original string of sig and the parameters in the actual request URL must be consistent and sorted according to the dictionary.

Image description

3.It will be okay as long as Required fields are all usually included in the request URL, the version, seq and conn are optional.



Copyright © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""