Login via VK
Add dependencies
- Android
- iOS
- Unity
- Unreal
Add the following code in build.gradle on the app-level, and replace $msdk_version with the actual MSDK version.
dependencies {
implementation "com.garena.sdk.android:login-vk:$msdk_version"
}
Configuration
- Android
- iOS
- Unity
- Unreal
Configure AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
...
<integer name="com_vk_sdk_AppId">[vk_app_id]</integer>
</resources>
Add the following to the info.plist:
- Add vkauthorize to LSApplicationQueriesSchemes
- Add VK_APP_ID obtained from VK as VKAppID
- Add VK_APP_ID with vk prefix to URL Schemes
<key>VK_APP_ID</key>
<string>YOUR_VK_APP_ID</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>vkYOUR_VK_APP_ID</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>vkauthorize</string>
</array>
Usage
- Android
- iOS
- Unity
- Unreal
AccountManager accountManager = new AccountManager(activity);
accountManager.login(PlatformType.VK, onLoginListener);
[MSDKLoginManager loginWithPlatform:MSDKePlatformVk completion:^(MSDKLoginRet *loginRet) {
// handle login result
}];
GMSDKHandler.LoginClient.Login(AccountPlatform.Vkontakte, OnLoginCallback);
UMsdkLogin::Login(EPlatform::Vk);
By default, VK permissions are needed: WALL, PHOTOS, FRIENDS, OFFLINE, VIDEO
If you don't need any permission, you can override the default permissions
- Android
- iOS
- Unity
- Unreal
accountManager.login(new VKLoginParams(Arrays.asList(VKPermission.WALL, VKPermission.PHOTOS)), onLoginListener);
MSDKVKLoginParam *vkParam = [[MSDKVKLoginParam alloc] initWithPermissions:@[MSDKVKPermission.wall, MSDKVKPermission.photos]];
[MSDKLoginManager loginWithParam:vkParam completion:^(MSDKLoginRet *loginRet) {
// handle login result
}];
var vkLoginParams = new VkLoginParams
{
vkPermissions = new List<VkPermission> { VkPermission.Wall, VkPermission.Friends }
};
GMSDKHandler.LoginClient.Login(vkLoginParams, OnLoginCallback);
UVkLoginParams *VkLoginParams = NewObject<UVkLoginParams>();
VkLoginParams->vkPermissions = {EVkPermission::Wall, EVkPermission::Friends};
UMsdkLogin::LoginWithParams(VkLoginParams);