Register and Login [MSDK Only]
[MSDK Only] To use email or phone number registration and login for self-built accounts, you can call the Login interface and pass parameters in JSON format through extraJson.
Supported platforms
- Unity
- Unreal Engine
Supports
Android, iOS, Windows platform.Supports
Android, iOS, Windows platform.Function Definition
- Unity
- Unreal Engine
void Login(string channel, string permissions = "", string subChannel = "", string extraJson = "{}");
static void Login(const std::string &channel, const std::string &permissions = "", const std::string &sub_channel = "", const std::string &extra_json = "{}");
Input Parameters
- Unity
- Unreal Engine
| Parameters | Type | Description |
|---|---|---|
| channel | string | [Required] Channel name "Self" refers to the custom channel |
| permissions | string | Permissions Leave blank "" |
| subChannel | string | Sub-channel Leave blank "" |
| extraJson | string | Extension field, registration and login function parameters |
extraJson
{
"type": "register", // Login type - registration
"account": "150xxxxxx87", // Account
"password": "123456678", // Password
"verifyCode": 12323, // Verification code
"extraJson": "", // Extension field used during registration, empty
"accountType": 2, // Account type, 1: email, 2: mobile number
"langType": "zh_CN", // Language type, language of messages sent
"areaCode": "86" // Area code, must be filled for mobile number accounts; for email accounts, area code is optional
// For the areaCode field, the game should let the player choose, not enter manually
}
| Parameters | Type | Description |
|---|---|---|
| channel | string | [Required] Channel name "Self" refers to the custom channel |
| permissions | string | Permissions Leave blank "" |
| subChannel | string | Sub-channel Leave blank "" |
| extraJson | string | Extension field, registration and login function parameters |
extraJson
{
"type": "register", // Login type - registration
"account": "150xxxxxx87", // Account
"password": "123456678", // Password
"verifyCode": 12323, // Verification code
"extraJson": "", // Extension field used during registration, empty
"accountType": 2, // Account type, 1: email, 2: mobile number
"langType": "zh_CN", // Language type, language of messages sent
"areaCode": "86" // Area code, must be filled for mobile number accounts; for email accounts, area code is optional
// For the areaCode field, the game should let the player choose, not enter manually
}
Callback Handling
The callback handler interface is GUALoginResultObservers.The callback data structure is GUALoginResult.
- Unity
- Unreal Engine
The callback event is LoginResultEvents.The callback ID is GUA_ACCOUNT_LOGIN.
The callback event is OnLoginResultNotify. The callback ID is kMethodIDAccountLogin.
Code Example
- Unity
- Unreal Engine
UnionAdapterAPI.GetAccountService().Login("Self", "", "", "extraJson");
GUA_NAMESPACE::GUAAccountService::Login("Self", "", "", "extraJson");