Skip to main content

Configuring Garena Login

note

To integrate the Garena SDK, please contact the Player Network assistant for a separate plugin

The Player Network assigns a channel ID of 10 to the Garena login, and the channel definition is INTLChannel.Garena in the Unity Engine and EINTLLoginChannel::kChannelGarena in the Unreal Engine.Player Network supports the Garena login on the following platforms:

The Garena SDK integrates with many third-party SDKs, including many login SDKs.These login channels are provided as Garena subchannels in the Player Network SDK. For example: third-party channels like Facebook and Google must be configured on the Garena developer platform.

note

After Player Network SDK version 1.16, Player Network SDK will switch the Garena environment based on the INTLConfig.ini INTL_URL property.Garena will be in the test environment when the Player Network SDK is in the test/dev/debug environment, and in the official environment when the Player Network SDK is in any other environment.
Garena test environment domain: https://intlsdk-new-test.iegg.garena.com
Garena production environment domain: https://intlsdk-new.iegg.garena.com

Currently, the Player Network SDK supports logging into Garena sub-channels including:

  • Android:Guest, Garena, Facebook, Google
  • iOS:Guest, Garena, Facebook, Apple, Google
  • Windows:Garena, Facebook, Google, Apple

Bindings

There are two types of bindings depending on the sub-channel of the currently logged in Garena account:Visitor Binding and Platform Account Binding.

  1. Visitor Binding
    After logging in through Garena's Visitor sub-channel, Visitor accounts can be bound to other Garena sub-channels.

  2. Platform Account Binding
    After logging in through Garena's non-guest sub-channels, you can bind other sub-channel accounts by using your login as the primary account.Before binding, call Request Platform Binding Info to see which platforms are available for binding.
    The account tied to the primary account is the secondary account.After binding, if the user logs in with a secondary account, Garena will return the uid and token of the primary account to which they are bound.

Reset Garena Guest

After successfully binding the Garena Visitor account, the game needs to call the interface to reset the data of the Garena Visitor account.

If the visitor account is not reset after a successful bind, the visitor account login will return a 2203/1204 (iOS) or 2019 (Android) error code, causing the visitor account login to fail.

Code Example

// Add callback
public void AddAuthObserver()
{
INTLAPI.AddAuthResultObserver(OnAuthResultEvent);
INTLAPI.AddExtendResultObserver(OnExtendEvent);
}

// Remove Callback
public void RemoveAuthObserver()
{
INTLAPI.RemoveAuthResultObserver(OnAuthResultEvent);
INTLAPI.RemoveExtendResultObserver(OnExtendEvent);
}

public void OnAuthResultEvent(INTLAuthResult ret)
{
if (ret.MethodId == (int)INTLMethodID.INTL_AUTH_BIND)
{
if(ret.Channel.Equals(INTLChannel.Garena) && ret.RetCode == INTLErrorCode.SUCCESS)
{
// In the AuthResult callback, invoke resetGuest straightaway if the method is bind, the channel is Garena and the return code is success
INTLAPI.ExtendInvoke(INTLChannel.Garena, "resetGuest", "");
}
}
}

public void OnExtendEvent(INTLExtendResult ret)
{
// Extend callback
}

Request for Platform Binding Information

After calling RequestPlatformBindingInfo, bound_accounts and available_platforms will be returned as JSON strings in the ret_msg field of the ExtendResult.The JSON string has the following structure:

{
"bound_accounts": [
{
"platform": "Apple",
"create_time": 1627893394,
"uid": 133604802,
"user_info": {
"nickname": "intl",
"gender": 0,
"icon": "http://image.png"
}
}
],
"available_platforms": [
"Garena"
],
"primary_platform": "Apple"
}

Possible values for gender:0 = unknown, 1 = male, 2 = female.

Before platform account binding, use this method to check available_platforms with the platform name as a subchannel of the binding.

Code Example

// invoke function
INTLAPI.ExtendInvoke(INTLChannel.Garena, "requestPlatformBindingInfo", "");

public void OnExtendEvent(INTLExtendResult ret)
{
// callback
}