Skip to main content

Auto Login (AutoLogin)

[Shared by Player Network SDK & MSDK] AutoLogin will automatically retrieve the local login state and verify with the server whether the login state is valid. If there is no local login state cache or the server returns that the login state is invalid, the AutoLogin callback will return a failure result.

note

[Player Network SDK Only] Accessing custom accounts requires SetAccountInfo.

note

If the game sets LOGIN_NETWORK_ERROR_CLEAR_RESULT_ENABLE (INTL) or MSDK_LOGIN_NETWORK_ERROR_CLEAR_RET (MSDK) to false, when AutoLogin fails (for example, because the authentication token has expired), the returned GUALoginResult will include the channel, channel ID, username, and avatar URL of the last account used for AutoLogin.Displaying this information can guide the user to log in again.
Additionally, if the last account used for AutoLogin is a custom account, the extra JSON field in GUALoginResult will also include the account (i.e., the email or phone number used for registration).

Supported platforms

Supports Android, iOS, Windows platform.

Function Definition

void AutoLogin();

Callback Handling

The callback handling interface is GUALoginResultObservers.The callback data structure is GUALoginResult.

The callback event is LoginResultEvents. The callback ID is GUA_ACCOUNT_AUTOLOGIN.

Code Example

UnionAdapterAPI.GetAccountService().AutoLogin();