Skip to main content

Login Access

Client Login Access

Proceed with the following steps immediately after Step Five

Step 6: Add Callback Handling

  • You need to add AuthResultObserver and LIEventObserver callbacks to handle login component events;

  • The callback data structure is INTLAuthResult, which contains login information and account details, such as OpenID, account binding information, and account deactivation status.

// Add Callbacks
INTLAPI.AddAuthResultObserver(OnAuthResultEvent);
LevelInfinite.AddLIEventObserver(OnLIBaseEventResult);

// Handle AuthResultObserver Callback Result
private void OnAuthResultEvent(INTLAuthResult AuthResult)
{
switch (AuthResult.MethodId)
{
case (int)INTLMethodID.LI_LOGIN_ENTER_GAME:
if(AuthResult.RetCode == (int)ERROR_CODE.SUCCESS) {
Debug.Log("LI PASS Login success");
} else {
Debug.Log("LI PASS Login failed, ret_code = " + AuthResult.RetCode + ", ret_msg = " + AuthResult.RetMsg);
}
break;
case (int)INTLMethodID.LI_AUTOLOGIN_ENTER_GAME:
if(AuthResult.RetCode == (int)ERROR_CODE.SUCCESS) {
Debug.Log("LI PASS Autologin success");
} else {
Debug.Log("LI PASS Autologin failed, ret_code = " + AuthResult.RetCode + ", ret_msg = " + AuthResult.RetMsg);
}
break;
default:
break;
}
}

// Handle LIEventObserver Callback Result
private void OnLIBaseEventResult(LIBaseEventResult liRet)
{
switch (liRet.lIEventType)
{
case LIEventType.GN_READY:
break;
default:
break;
}
}

Step Eight: Complete the LIPASS Login Process

  1. Call the AutoLogin interface to verify the player’s identity through login status stored in local cache;
  2. Add the following code in the AuthResultObserver callback to handle automatic login results.If automatic login succeeds, the player enters the game;
  3. If automatic login fails, you need to call the OpenLoginPanel interface to open the LI PASS login component.This login component can complete LI PASS registration, login, and compliance process;
  4. In LIEventObserver, handle the callback for LI PASS login success to enter the game.

Continue to improve logic in the Observer:

// Handle AuthResultObserver Callback Result
private void OnAuthResultEvent(INTLAuthResult AuthResult)
{
switch (AuthResult.MethodId)
{
case (int)INTLMethodID.LI_LOGIN_ENTER_GAME:
if(AuthResult.RetCode == (int)ERROR_CODE.SUCCESS) {
Debug.Log("LI PASS Login success");
// If LI PASS login is successful, add your go-to lobby code here
} else {
LevelInfinite.OpenLoginPanel();
Debug.Log("LI PASS Login failed, ret_code = " + AuthResult.RetCode + ", ret_msg = " + AuthResult.RetMsg);
}
break;
case (int)INTLMethodID.INTL_AUTH_AUTOLOGIN_FOR_LI:
if (ret.RetCode == INTLErrorCode.SUCCESS)
{
Debug.Log("LI PASS Autologin success");
// If LI PASS login is successful, add your go-to lobby code here
}
else
{
LevelInfinite.OpenLoginPanel();
Debug.Log("LI Autologin failed, ret_code = " + AuthResult.RetCode + ", ret_msg = " + AuthResult.RetMsg);
}
break;
default:
break;
}
}

Step Nine: More Callback Processing

Developers may also add LILuaErrorObserver callbacks to handle Lua errors.

Configure Login Channels

The various login channels below the LI Pass login screen can be displayed by configuring INTLConfig.ini.Different platforms show different channels.The order of channels corresponds to the display order.

ACCOUNT_THIRD_CHANNEL_ANDROID = Guest,Facebook,Google,Twitter,Line
ACCOUNT_THIRD_CHANNEL_IOS = Guest,Facebook,Twitter,Apple,Line

Configure Guest Channel

Using Guest Channel requires two steps:

  1. Turn on the Guest switch in Player Network Console
  2. Add Guest to the channel list in INTLConfig.ini as shown in the code above.

Guest

Guest

  • Account Status: Whether to keep or reset the original guest account after binding other social channels
  • Login Status: Whether the original guest account’s login status will be switched to the corresponding social channel after binding other social channels

For more guidance on the Guest channel, please refer to the documentation

Configure Third-Party Login Channels

This article uses the Facebook channel as an example to introduce how to integrate the Facebook channel into LI Pass.Requires three steps:

  1. Download the INTLFacebook plugin, merge into the project
  2. Configure Facebook's APP_ID, APP_KEY information in the Player Network Console.
  3. Add Facebook to the channel list in INTLConfig.ini as shown in the code above.
  4. Configure the AppID and other information for Android and iOS. Refer to the Facebook channel integration method for details.

LI Pass supports multiple mobile third-party channels.Includes (but is not limited to):

You can go to each channel to learn more about integration details.

Backend Login Access

For more information, refer to Backend Integration in the integration overview.

Mobile Build Guide

For more information, refer to Mobile Build Guide in the integration overview.