05/15/2024 15:19:45

Solution

During its development phase, your game needs to log into the Editor environment for joint debugging. MSDK currently provides a simulated login scheme for games to conduct joint debugging in the Editor environment. At present, MSDK provides simulated login schemes for Unity and UE4. Their implementation principles are the same.
The simulated login replaces token and uses a universal token. This scheme can only be used in the test environment.
If games newly accessing to MSDK need to use this function, please contact MSDK Assistant via their corporate WeChat.
The channels currently supporting Simulated Login are: WeChat, QQ, Facebook, GameCenter, Google, Twitter, Garena, and Line.

[info] Simulated login in the formal environment
Simulated login in the formal environment must use real openid and token; otherwise, it can't pass verification.

I. Unity's Simulated Login

The simulated PC login is performed according to the following steps (take WeChat as an example):

  1. Click WeChat channel login on the PC. MSDK will create a .txt file for the simulated login status information of the corresponding channel under the "Assets/GCloudSDK/Scripts/MSDKCore/MSDK/UnityEditor/Data/" directory. For example, the file for WeChat is WeChatLoginData.txt. If you don't see it in the editor, right-click the "Refresh" button.
  2. Package the game to your mobile phone and then run it on it, obtain the login status information from the log, and copy it to the WeChatLoginData.txt file. After completing the above two steps, you can log in the game on your PC.

Precautions:

  1. If you changed the Assets/GCloudSDK/plugin directory, modify the path of dataFilePath in UnityEditorData.cs
  2. By default, there is a LoginData.txt file in the "xxx/MSDK/UnityEditor/Data/" directory to save the current login status information

II. UE4's Simulated Login

Supported from GCloud V2.0.4 version In order to make the game easier to test login in the Editor on Mac and Windows platforms, a simulated login function is implemented

Image Description

First create a new "Content" folder in the directory of the MSDKCore plugin, and create a new channel+sub-channel+LoginData.txt file in the Content folder. If the sub-channel is empty, leave it blank. Please refer to the following diagram

Image Description

Get the log of the login from the real machine. How to get it will be explained in detail below. Fill the obtained log into the LoginData.txt file, which must conform to the JSON format

After completing the above two steps, you can log in the game on PC.

III. How to Get the Login Status

3.1 Get Android Login Log

After installing the game App on your Android phone, filter the log via Tag:MSDK in Logcat. After logging in App, search for OnLoginResp in the result and copy the login result in the log.

Image Description

3.2 Get iOS Login Log

After installing the game App on iPhone/iPad, open the MAC console and select the test machine. After logging in App, search for OnLoginResp in the result and copy the login result in the log.

Image Description

[info] You can directly copy the code in the login status example and fill it in the LoginData.txt file of the corresponding channel. Feel free to change openid. If you need to test the purchase in PC, you need to take real 'openid', 'pfKey' and other related fields from the real machine.

IV. Login Status Examples

1.WeChat's login status example: the content of WeChatLoginData.txt

{
  "extraJson": "",
  "methodNameID": 112,
  "retCode": 0,
  "retMsg": "Success",
  "thirdCode": 0,
  "thirdMsg": "success",
  "channel": "WeChat",
  "channelid": 1,
  "channel_info": "{\"code\":\"071H5ihk0HTfoq1W6Pek0MYuhk0H5ihH\",\"access_token\":\"16_l4kRVRLBvAUfUyWXz6evSZwwXvNcrTj-XdIVC4ryc5koTQeymyvsELbyZ8zH0SU-6EheFuY78jNF7zaymzF_uObPf9d92U3JK9fddJXUnRI\",\"expired\":7200,\"refresh_token\":\"16_caPx3PRfwkP8NOGL89Q4H4h_k-eEBNSLKIekJsC82tW3iCMUZNfkVKNcVaZyLZKzQEU-hCACRJpBua422UEAB9_UjwY2SQqu_9663IdR25E\",\"scope\":\"snsapi_userinfo,snsapi_friend,snsapi_message\",\"funcs\":\"\",\"other_funcs\":\"\",\"extend\":\"\"}",
  "uid": "oHlap1QDpmRiwliuWdvMH3mAWnQM",
  "first": 0,
  "gender": 0,
  "health_game_ext": "{\"serial_number\":\"oHlap1QDpmRiwliuWdvMH3mAWnQM-1543845913-ahnZ\",\"prajna_ext\":\"{ \"type\": 0, \"webview_frame\": { \"buttons\": [  ], \"show_title\": 0, \"show_titlebar\": 0, \"url\": \"\" } }\",\"username\":\"\"}",
  "openid": "3042973086530817307",
  "pf": "wechat_wx-App Store-android-App Store-wx-xxxxx-oHlap1QDpmRiwliuWdvMH3mAWnQM",
  "pfKey": "74ffe118eb96e85e87957566796fcc40",
  "picture_url": "",
  "need_name_auth": false,
  "reg_channel_dis": "",
  "seqID": "11-afd9d432-0527-4429-a905-5e9742399f30-1543845916-14",
  "token": "MSDKLOGINMOCKER_51433213c2e72a6304fb805b10a2201d",
  "token_expire_time": 1543853113,
  "user_name": "rdgztest_INWRBE"
}

2.QQ's login status example: the content of QQLoginData.txt

{
  "ret": 0,
  "msg": "success",
  "openid": "3042973086530817307",
  "token_expire_time": 1541658617,
  "first": 0,
  "reg_channel_dis": "",
  "user_name": "kysduolc",
  "picture_url": "http://qzapp.qlogo.cn/qzapp/ 1106977030/FA1981312F1A9ABA31CC5EC5E62690B9/100",
  "need_name_auth": false,
  "channel_info": "{\"pay_token\":\"493C9D67E5F3C653253F9CA8D8043498\",\"access_token\":\"0 3FE61DCBC55C86C18B9455D5D91AA89\",\"openid\":\"FA1981312F1A9ABA31CC5EC5E62690B9\",\"expired\":0,\"refresh_ token\":\"\",\"scope\":\"\",\"funcs\":\"\",\"other_funcs\":\"\",\"extend\":\"\"}",
  "extra": "",
  "retCode": 0,
  "retMsg": "Success",
  "token": "A23EsnNaIT@7ISkex5JOg3Tl@LMFlDS3SvzqsEp14wiuK087owIv4vgu BV6MVGU5",
  "gender": 0,
  "pf": "qq_qq-00000000-android-00000000-qq-110 6977030-FA1981312F1A9ABA31CC5EC5E62690B9",
  "pfKey": "",
  "channel": "QQ",
  "channelID": 2,
  "methodNameID": 112
}

3.Guest's login status example: the content of GuestLoginData.txt

{
  "ret": 0,
  "msg": "success",
  "openid": "6020163207300203881",
  "token_expire_time": 1555812357,
  "first": 1,
  "reg_channel_dis": "",
  "user_name": "",
  "picture_url": "",
  "need_name_auth": false,
  "channel_info": "{\"uuid\":\"b640b767-9d92-45f0-8149-8fd33d769894\",\"access_token\":\"6dd0a5f22c5bddb5e74d481db6dbbb8ec6fc094a\",\"expired\":0,\"refresh_token\":\"\"}",
  "bind_list": "",
  "confirm_code": "",
  "confirm_code_expire_time": -2282828787735330816,
  "retCode": 0,
  "retMsg": "Success",
  "token": "7ca255b0fd2cc21380ab4ddd1e0a410a8c66ef91",
  "gender": 0,
  "pf": "guest_gs-00000000-android-00000000-gs-00-b640b767-9d92-45f0-8149-8fd33d769894",
  "pfKey": "e8f82e9551896ab732dafe510288a787",
  "channel": "Guest",
  "channelID": 3,
  "methodNameID": 112,
  "extraJson": ""
}

4.Facebook 's login status example: the content of FacebookLoginData.txt

{
  "ret": 0,
  "msg": "success",
  "openid": "2355738011190361112",
  "uid": "224557048495562",
  "token": "6f5bd082f9972b7bdb6c516bc1df605bf2f1d7f5",
  "token_expire_time": 1555570474,
  "first": 0,
  "reg_channel_dis": "App Store",
  "user_name": "Công Phượng",
  "gender": 0,
  "picture_url": "https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=224557048495562&height=50&width=50&ext=1555570473&hash=AeQQj1MotyFo6xvo",
  "pf": "facebook_fb-App Store-iap-App Store-fb-371085970095922-224557048495562",
  "pf_key": "89baba8a5e12ed954fdfe2b0266fb528",
  "need_name_auth": false,
  "channel_info": "{\"access_token\":\"EAAFRgC9tvzIBANTcaIcjBz2fK5QK2GnhKTvWNLlGoF2rq0HtZC08KivVkYNA48nx0jmla0aXUEYwnH1oINb9Azo3D6qeZCn1mm066BzDh6bZBDh8ISxx2LpuQeEqEY7ZAqxsr4ZC3dPUYGjCUj7XfgNezVQEEFFcVdBKiETdRMWzVvoORKsfIrh6fUFPlTJwB3gC69Ff88pAWEcD3S1acP6oBzMgLw6kZD\",\"seq\": \"11 - seXEMyVaFv5QBkCo2CasBbHu8W9JHOfNTCjVLaJkUAPtPo8XJ89G2R7BlAKGcoar - 1552978424 - 5\"\"}"
}

5.Logout can add the following content in Logout.txt. The return value of successful Logout can be gotten in the Editor mode

{"ret":1,"msg":"","methodNameID":117,"retCode":0,"retMsg":"Success","extraJson":""}



Copyright © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""