05/15/2024 15:19:45

Overall Description of the Backend

I. Access Process

Please contact MSDK assistant

II. The Backend Access Mode

Http (rest api) mode is a mode that directly calls http interface on the game server to make authentication and draw the friend relationship

III. Overall Description

  1. HTTP/HTTPS interface protocol, POST request;
  2. The request URL carries fixed parameters, including: os, gameid, channelid, version, sig, ts, etc.
  3. POST body is a json string;
  4. All parameters in interface are utf8 encoding;
  5. The backend interface's timeout is 3100ms;

3.1 Environment

Environment (Domain Name) HTTP Intranet HTTPS Extranet
Test hktest.itop.tencent-cloud.net hktest.itop.qq.com
Public Not available yet Not available yet

Note: the backend environment and Client Environment (MSDK_URL) need to be consistent.

3.2 Request URL

  1. URL format: http://xxxxx/v2/modulename/interfacename?os=1&gameid=11&channelid=1&ts=1528097722&version=0.1&sig=xx
    • modulename: function classification;
    • interfacename: Interface name
  2. Description of fixed parameters;
Parameter Type Description
os string [Required] operating system marker 1 - Android, 2 - iOS, 3 - Web, 4 - Linux, 5 - windows....
gameid string [Required] game id assigned by MSDK
channelid int [Required] login channel id1 - WeChat, 2 - QQ (mqq), 3 - Guest, 4 - Facebook, 5 - GameCenter,6 - GooglePlay,7 - IEGPass,9 - Twitter,10 - garena,11 - SelfAccount,12 - EGame,14 - Line,15 - Signin with Apple,17 - Kwai
ts uint32 [Required]Unix time
version string indicate the SDK version carried; the default is empty (the client call needs to take it!)
sig string [Required] signature field; the signature algorithm is md5(path + "?" + params + body + sigkey),
1, path: interface path, such as authentication interface name/v2/auth/verify_login
2, params: two steps are required; a. Interface request parameters other than sig (that is, and The other parameters in the url in the current interface call remain the same), b. The parameters are sorted according to the dictionary
3, body: the body part of the post, the body part does not need to be sorted in a dictionary, and the order can be passed in order according to the order of the interface parameters.
4. sigkey: sigkey is strongly related to the source field. When MSDK checks sig in the background, the sigkey corresponding to source is used for sig calculation.
When the source is not filled in or is 0, the corresponding sigkey uses [Feiying System] (http: //dev.ied.com/) MSDK_SDK_KEY in the parameter;
When the source is 1, the corresponding sigkey uses the MSDK_SERVER_KEY in the Feiying System parameter;
When the source is 2, the corresponding sigkey uses the MSDK_MIDAS_KEY in the Feiying System parameter;
5, md5 calculation
Example: /v2/auth/ verify_login?channelid=1&conn=&gameid=11&os=2&seq=&source=0&ts=1556072078&version={"openid":"11219380013689673060","token":" B8D116F42A6A8116398C40AED587195C"}sigkey

Can be accessed in Feiying System>MSDK>MSDK tools>V5 tool to simulate the server interface call, and then view the system calculation in the url The sig value that comes out is compared and verified with the sig calculated by the business.If the backend request returns ["ret":1008,"msg":"invalid sig!"], you can check it with the V5 signature tool (Feiying System>MSDK access>MSDK tools>V5 signature). The system will help the app calculate the correct sig based on the URL and PostBody spliced by the app itself, so that the app can easily locate the cause of sig calculation errors.

The signature method of the message decryption interface (/v2/auth/decrypt) is different from others, the method is: md5 (timestamp+encrypted data+sigkey)
seq string the parameter indicates the transparent transmission parameter, which can be carried in the returned json; it is used for the asynchronous call side. It can only be composed of English letters, numbers and underscores; the default is empty
source int [Required] access source. 1 - game backend, 2 - Midas
cgsource string [Cloud game authentication is required, and other requests cannot carry this field]
The authentication ID of the cloud game mode login is filled in with gamematrix fixedly, for example: cgsource=gamematrix

3.3 Description of the Response and Errors

After data is sent via http protocol, the status code is gotten. If the code is 200, it indicates that the request is normal, that is, the content returned by http can be gotten and the json string can be parsed into an array. If it is not 200, it indicates request failure. At this time, directly print the result to view the problem. The return package format is as follows:

{
"ret": 0, 
"msg": "user is logged in", 
.................
}
  • ret = 0, indicate that the request is successful and the relevant return field information can be parsed;
  • ret != 0, indicate request logic failure; there is specific error information in msg; no other field returns.



Copyright © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""