Skip to main content

iOS

This article is intended to introduce how to set up QQ authentication, allowing your game to use Player Network login authentication service via the QQ channel.

Prerequisites

1. Configure your game on the QQ Connect platform
1. Create a QQ application
  1. Log in to QQ Connect.

  2. In the sidebar, click App Management.

  3. Click Create Application.

    Image: Create Application

  4. Under Mobile Application Information, enter your iOS application details.

    • iOS UrlScheme: tencent{INTL_QQ_APP_ID}. Replace {INTL_QQ_APP_ID} with the QQ-assigned AppID for your game.

    Image: Mobile App Information

2. Retrieve application information
  1. Log in to QQ Connect.

  2. In the sidebar, click App Management.

  3. In the Actions column of the corresponding application, click Edit.

    Image: Edit Apps

  4. On the application edit page, confirm the QQ application's AppID and AppKey.

    Image: App Information

3. Apply for QQ Connect OpenAPI capability is_login permission

If your application is not approved, even if QQ app authorization login succeeds, Player Network SDK backend will return the error app has no privilege to use this api.
Please send an email to apply for permission using the following template:

For more information, see is_login.

  1. Enter the Player Network Console to create a new project for your game or join an existing one.
  2. Download SDK.
  3. Integrate the SDK.
  4. Add QQ as a login authentication method for your business in the Player Network Console.

Step 1: Configure SDK for QQ login

  1. 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://test.intlgame.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

    [QQ channel configuration]
    QQ_APP_ID = {INTL_QQ_APP_ID}
    • Set the SDK backend environment to INTL_URL = https://test.intlgame.com.
    • Replace {INTL_GAME_ID} and {INTL_SDK_KEY} with the GAME_ID and SDK_KEY values assigned by the 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.
    • Replace {INTL_QQ_APP_ID} with the AppID assigned by QQ.
  2. Add QQ configuration.

Open INTLCoreKit.projmods and replace {INTL_QQ_APP_ID} with the QQ AppID before exporting the Xcode project from Unity.

{
"group": "INTL",
"libs": [
"libz.tbd",
"libstdc++.tbd",
"libiconv.tbd",
"libsqlite3.tbd"
],
"frameworks": [
"Security.framework",
"SystemConfiguration.framework",
"CoreTelephony.framework",
"CoreGraphics.framework"
],
"files": [],
"folders": [],
"excludes": [
"^.*.meta$",
"^.*.mdown$",
"^.*.pdf$"
],
"headerpaths": [],
"build_settings": {
"OTHER_LDFLAGS": ["-ObjC"],
"ENABLE_BITCODE": "NO"
},
"system_capabilities": {},
"Info.plist": {
"LSApplicationQueriesSchemes": [
"tim",
"mqq",
"mqqapi",
"mqqwpa",
"mqqbrowser",
"mttbrowser",
"mqqOpensdkSSoLogin",
"mqqopensdkapiV2",
"mqqopensdkapiV3",
"mqqopensdkapiV4",
"wtloginmqq2",
"mqzone",
"mqzoneopensdk",
"mqzoneopensdkapi",
"mqzoneopensdkapi19",
"mqzoneopensdkapiV2",
"mqqapiwallet",
"mqqopensdkfriend",
"mqqopensdkdataline",
"mqqgamebindinggroup",
"mqqopensdkgrouptribeshare",
"tencentapi.qq.reqContent",
"tencentapi.qzone.reqContent"
],
"NSAppTransportSecurity": {
"NSAllowsArbitraryLoads": true
},
"CFBundleURLTypes": [
{
"CFBundleTypeRole": "Editor",
"CFBundleURLName": "tencent",
"CFBundleURLSchemes": ["tencent{INTL_QQ_APP_ID}"]
}
]
}
}

Replace {INTL_QQ_APP_ID} with the AppID assigned by QQ.

Step 2: Add QQ login

Pass in permissions when calling INTLAPI.Login.Pass in permissions when calling INTLAPI.Login.It is recommended to pass in "all", which indicates all platform-side permissions previously requested have been granted.

PermissionsDescription
get_simple_userinfoQQ login permission (obtain QQ user information on mobile)
  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 ret)
{
Debug.Log($"MethodID: {ret.MethodId}");

string methodTag = "";
if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_LOGIN)
{
methodTag = "Login";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_BIND)
{
methodTag = "Bind";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_AUTOLOGIN)
{
methodTag = "AutoLogin";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_QUERY_USER_INFO)
{
methodTag = "QueryUserInfo";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_GET_AUTH_RESULT)
{
methodTag = "GetAuthResult";
}
}
  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.
INTLAPI.Login(INTLChannel.QQ, "all", "");
  1. Synchronize client authentication status with the game backend and wait for the final verification result.

Scan code login

Player Network SDK V1.26.00 supports QQ code scanning login for both Android and iOS platforms.

By default, if QQ app is installed on the phone, it will launch QQ app for login directly. If QQ app is not installed, it will automatically switch to code scanning login.To change the default behavior, you can specify the qrcode_mode parameter in extraJson:

qrcode_modeDescription
autoAuto mode (default):
Prioritize QQ app login. If QQ app is not installed, use code scanning login.
force_appForce QQ app login:
Login will fail if QQ app is not installed.
force_qrcodeForce code scanning login:
Code scanning will be used for login regardless of whether QQ app is installed.
string permissions = "";
string extraJson = "{\"qrcode_mode\" : \"force_qrcode\"}";
INTLAPI.Login(INTLChannel.QQ, permissions, extraJson);

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 the integration process, please refer to Frequently Asked Questions.