iOS
This article guides you through setting up VK as an identity provider, enabling your iOS game to access Player Network authentication services.
Prerequisites
1. Set up the VK App on the VK developer website
1. Create a VK app
The following information was last updated on February 5, 2024. For the latest information, refer to VK developer website.
VK apps can no longer be created from the VK developer website, follow the below steps to be redirected to the VK ID developer website.
VK ID is not supported by Player Network SDK at the moment. For detailed information and version support plans, reach out to the Player Network represenative.
Log in, or register for an account on the VK developer website.
Go to the Create an app page and enter the below information.
- Title: Name of the app
- Platform: Type of app to be created
Click Go to service to be redirected to the VK ID developer website.
2. Configure the app
Enter App information
Go to the VK developer website.
Enter the app information on the Information page of the corresponding app.
Click Save to save the entered information.
Enable OpenAPI
- Enable OpenAPI.
- Add the following base domains:
- dev-common-web.intlgame.com
- debug-common-web.intlgame.com
- test-common-web.intlgame.com
- common-web.intlgame.com
Get Android Fingerprint
To get the Android fingerprint, follow the instructions in Get the SHA1 Value for Android.
SDK Settings
Go to the Settings page of the app.
In the SDK settings section, enter App Bundle ID for iOS,Package name for Android, and Signing certificate fingerprint for Android.
Get App ID, Secure key and other information
Go to the Settings page of the app, and get the App ID and other information.
- Create an account for Player Network Console.
- Create a new project for your game, or join an existing one.
- Download the SDK.
- Integrate the SDK.
- Add VK as an authentication method for your project on Player Network Console.
Step 1: Configure the SDK for VK login
If authorized by VK, add URL Schemes to the App.
Xcode 5:
- Open the App settings.
- Select info/URLTypes.
- Set Identifier and URL Schemes to
vk+APP_ID
.
Xcode 4:
- Open
info.plist
. - Add a line for URL Types.
- Set URL identifier to
vk+APP_ID
.
Open the project's INTLConfig.ini:
[VK Channel Configuration]
VK_APP_ID = {INTL_VK_APP_ID}
Replace {INTL_VK_APP_ID}
with the registered VK App ID.
Step 2: Add VK login
Add an observer to handle authentication callbacks.
- Unity
- Unreal Engine
// 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";
}
}C++ Event Handling (above v1.15)
//configure callback
FINTLAuthEvent authEvent;
authEvent.AddUObject(this, &OnAuthResult_Implementation);
UINTLSDKAPI::SetAuthResultObserver(authEvent);
// Remove callbacks
UINTLSDKAPI::GetAuthResultObserver().Clear();void OnAuthResult_Implementation(FINTLAuthResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}Unreal Event Handling
void OnAuthResult_Implementation(FINTLAuthResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}Call the
AutoLogin
method.- Unity
- Unreal Engine
INTLAPI.AutoLogin();
UINTLSDKAPI::AutoLogin();
Call the
Login
method to ask for user input if auto-login fails.- Unity
- Unreal Engine
INTLAPI.Login(INTLChannel.VK);
UINTLSDKAPI::Login(EINTLLoginChannel::kChannelVK);
Sync client authentication state with the game's backend and wait for the final authentication result.
Step 3: Test the login function
Search for the keyword "AuthResult" in the Player Network SDK logs to verify if the correct channel name and OpenID are returned. If they are, it indicates a successful configuration and the login function has been added successfully.