Password Login (Login) [MSDK Only]
[MSDK Only] To use email or phone number login with account and password, you can call the Login interface and pass parameters in JSON format through extraJson. The specific parameters are described as follows.
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 | Subchannel Leave blank "" |
| extraJson | string | Extension field, registration and login function parameters |
extraJson
{
"type": "register", // Login type - Register
"account": "150xxxxxx87", // Account
"password": "123456678", // Password
"verifyCode": 12323, // Verification code
"extraJson": "", // Extended field used during registration, empty
"accountType": 2, // Account type, 1: Email, 2: Phone number
"langType": "zh_CN", // Language type, language for sending messages
"areaCode": "86" // Area code, required for phone accounts; optional for email accounts
// 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 | Subchannel Leave blank "" |
| extraJson | string | Extension field, registration and login function parameters |
extraJson
{
"type": "register", // Login type - Register
"account": "150xxxxxx87", // Account
"password": "123456678", // Password
"verifyCode": 12323, // Verification code
"extraJson": "", // Extended field used during registration, empty
"accountType": 2, // Account type, 1: Email, 2: Phone number
"langType": "zh_CN", // Language type, language for sending messages
"areaCode": "86" // Area code, required for phone accounts; optional for email accounts
// For the areaCode field, the game should let the player choose, not enter manually
}
Callback Handling
The callback processing 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");