Skip to main content

Android

This article aims to introduce how to set up VK authentication so that your game can log in through the Player Network authentication service via the VK channel.

Prerequisites

1. Set up your game on the VK developer site

1. Create VK application

info

The following information was last updated on January 14, 2025. Please refer to the latest information on the VK developer site.

caution

Currently, you can no longer create VK applications on the VK developer site. Follow the steps below to navigate to the VK ID developer website.
Player Network SDK does not currently support VK ID. For details and version support plans, please contact the Player Network assistant.

  1. Log in or register on the VK developer site.

  2. Click Standalone-приложение.

    Image: VK Create App

  3. Navigate to the VK ID developer website to create an application.

    Image: VK Create App

2) Configure the application

Enter application information
  1. Visit the VK developer site.

  2. Enter the application information on the Information page for the corresponding application.

    Image: VK information

  3. Click Save to save the entered information.

Enable OpenAPI

Image: VK app base domain

  1. Enable OpenAPI.
  2. Add the following base domains:
    • dev-common-web.intlgame.com
    • debug-common-web.intlgame.com
    • test-common-web.intlgame.com
    • common-web.intlgame.com
Obtain Android fingerprint

To obtain the Android fingerprint, follow the instructions in Get the SHA1 Value for Android.

Image: VK SHA1

SDK settings
  1. Go to the Settings page of the application.
  2. In the SDK settings section, enter the App Bundle ID for iOS, Package name for Android, and Signing certificate fingerprint for Android.

Image: VK SDK Setting

Obtain App ID, Secure key, and other information

Go to the App's Settings page to get the App ID and other information.

Image: Player Network Settings

  1. Obtain a Player Network Console login account.
  2. Create a new project for the game, or join an existing project.
  3. Download SDK.
  4. Integrate the SDK.
  5. Add VK as a business login authentication method in the Player Network Console.

Step 1: Configure SDK for VK login

  1. In the AndroidManifest file, make sure the required permissions are added.VK requires internet access.

    <uses-permission android:name="android.permission.INTERNET"/>
  2. In the vk_integers.xml file under Assets/Plugins/Android/INTLVK.androidlib/res/values, add the following configuration.

    <integer name="com_vk_sdk_AppId">your_app_id</integer>

    Replace your_app_id with your registered VK App ID.

  3. Open your project's INTLConfig.ini file:

    [Android LifeCycle]
    LIFECYCLE = VK
    [VK]
    VK_APP_ID = {INTL_VK_APP_ID}
    • Add VK in LIFECYCLE.For more information, please see SDK Environment.
    • Replace {INTL_VK_APP_ID} with your registered VK App ID.

Step 2: Add VK 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 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.VK); 
  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 issues during integration, see FAQs.