Verification code login (Login) [MSD only]
[MSD Only] To use email or phone number login with a verification code, you must first obtain the code via the send verification code interface, then call the Login interface and pass the 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 this blank "" |
| extraJson | string | Extended field, parameters for registration and login features |
extraJson
{
"type": "register", // Login type - register
"account": "150xxxxxx87", // Account
"password": "123456678", // Password
"verifyCode": 12323, // Verification code
"extraJson": "", // Extended field used during registration, blank
"accountType": 2, // Account type, 1: email, 2: mobile phone
"langType": "zh_CN", // Language type, language of sent messages
"areaCode": "86" // Area code, required for mobile phone account; not required for email account
// For the areaCode field, the game should let the player choose, not type 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 this blank "" |
| extraJson | string | Extended field, parameters for registration and login features |
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: mobile phone
"langType": "zh_CN", // Language type, language of sent messages
"areaCode": "86" // Area code, required for mobile phone account; not required for email account
// For the areaCode field, the game should let the player choose, not type 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");