Skip to main content

Windows (computer)

The purpose of this article is to describe how to set up Garena authentication so that your game can be logged in through the Garena channel using the Player Network login authentication service.

Prerequisites

1. Setting up the Garena application

Contact the Garena team at:

  1. Activate the app and get the app ID and other relevant information.
  2. Configure the callback URL for Garena login in the Developer Platform:
  3. (Optional) Turn on APP_PLATFORM_BIND to enable platform account binding for Garena.
  1. Create an account for Player Network Console.
  2. Create a new project for your game, or join an existing one.
  3. Download SDK.
  4. Integrate the SDK.
  5. Add Garena as a login authentication method for your business in the Player Network Console.

Step 1:Configure SDK for Garena Login

Open your project's INTLConfig.ini file:

INTLConfig.ini
[INTL environment]
# WARNING: You should change this URL to the production environment when you release your game.
INTL_URL = https://intlsdk-new-test .iegg.garena.com
GAME_ID = {INTL_GAME_ID}
SDK_KEY = {INTL_SDK_KEY}
[INTL Log]
LOG_LEVEL = 1
LOG_CONSOLE_OUTPUT_ENABLE = 1
LOG_FILE_OUTPUT_ENABLE = 1
LOG_ENCRYPT_ENABLE = 0
LOG_ COMPRESS_ENABLE = 0
[Garena Channel Configurations]
GARENA_WEBVIEW_LOGIN_ENABLE = 1

  • Set the Player Network SDK authentication domain to INTL_URL = https://intlsdk-new-test.iegg.garena.com (contact the Garena team to provide).
  • Replace {INTL_GAME_ID} and {INTL_SDK_KEY} with the GAME_ID and SDK_KEY assigned by Player Network Console.
  • Set LOG_LEVEL = 1, LOG_CONSOLE_OUTPUT_ENABLE = 1, LOG_FILE_OUTPUT_ENABLE = 1, LOG_ENCRYPT_ENABLE = 0 and LOG_COMPRESS_ENABLE = 0 to output console logs and log files without encrypting or compressing the output without encrypting or compressing the output.
  • Sets the value of GARENA_WEBVIEW_LOGIN_ENABLE.The default value of 1 indicates that the Windows platform uses WebView login.If the user sets this value to 0, the Windows platform will use the system browser to log on.
caution

If GARENA_WEBVIEW_LOGIN_ENABLE in INTLConfig is set to 1, the INTLWebView plugin needs to be integrated, otherwise the login won't succeed.

Step 2:Add Garena Login

  1. Register login-related callbacks.
// Add callbacks
public void AddAuthObserver()
{
INTLAPI.AddAuthResultObserver(OnAuthResultEvent);
}

// Remove callbacks
public void RemoveAuthObserver()
{
INTLAPI.RemoveAuthResultObserver(OnAuthResultEvent);
}

// Process the INTLAuthResult callback
public void OnAuthResultEvent(INTLAuthResult AuthResult)
{
Debug.Log($"MethodID: {AuthResult.MethodId}");

string methodTag = "";
switch (AuthResult.MethodId)
{
case (int)INTLMethodID.INTL_AUTH_LOGIN:
methodTag = "Login";
break;
case (int)INTLMethodID.INTL_AUTH_BIND:
methodTag = "Bind";
break;
case (int)INTLMethodID.INTL_AUTH_AUTOLOGIN:
methodTag = "AutoLogin";
break;
case (int)INTLMethodID.INTL_AUTH_QUERY_USER_INFO:
methodTag = "QueryUserInfo";
break;
case (int)INTLMethodID.INTL_AUTH_GET_AUTH_RESULT:
methodTag = "GetAuthResult";
break;
}
}
  1. Call the AutoLogin interface to log in automatically.
INTLAPI.AutoLogin();
  1. If automatic login fails, call the Login interface to let the player log in manually.
note

Windows supports passing in subchannels, ExtraJson does not pass in subchannels, will default to the Garena official login, and supports all subchannels configured in the Garena developer backend.
Multiple entry parameters are different, as shown in the following example.

INTLAPI.Login(INTLChannel.Garena, "", "{\"appendix\":\"platform=1\"}");// Login Garena - Garena (1)
INTLAPI.Login(INTLChannel.Garena, "", "{\" appendix\":\"platform=3\"}");// Login Garena - Facebook (3)
INTLAPI.Login(INTLChannel.Garena, "", "{\"appendix\":\"platform=8\"}");// Login Garena - Google (8)
INTLAPI.Login(INTLChannel.Garena, "", "{\"appendix\":\"platform=10\"}");// Login Garena - Apple (10)
INTLAPI.Login(INTLChannel. Garena, "", "{\"appendix\":\"all_platforms=1\"}");// Login Garena - all platforms
INTLAPI.Login(INTLChannel.

The Garena login permission parameter is different from other channels.The user needs to enter numbers in string format.For example, "2" or "4".Permissions are defined as follows:

Image:Garena Permission

  1. Synchronize client authentication status with the game backend and wait for the final verification result.

Step 3: Acceptance testing for login functionality

Search for the keyword "AuthResult" in the Player Network SDK logs to confirm whether the channel name and OpenID are returned correctly.If correct, it means the integration configuration is successful, and login functionality has been successfully added.

If you encounter problems during integration, refer to FAQs.