Skip to main content

VK ID

Authorization Integration

This guide provides step-by-step instructions for integrating and configuring VK ID authorization in an Android application.

⚠️ Important: Request all necessary credentials and keys (VKIDClientID, VKIDClientSecret) from your project manager.


1. Project Repository Configuration

Add the VK SDK Artifactory repository URLs to your root project build configuration file (not inside the module-level build.gradle).

settings.gradle.kts (Kotlin DSL)

dependencyResolutionManagement {
repositories {
google()
mavenCentral()

...

// VK ID SDK Repositories
maven { setUrl("https://artifactory-external.vkpartner.ru/artifactory/vkid-sdk-android/") }
maven { setUrl("https://artifactory-external.vkpartner.ru/artifactory/maven/") }
}
}

Or Root build.gradle (Groovy DSL)

allprojects {
repositories {
google()
mavenCentral()

...

// VK ID SDK Repositories
maven { url "https://artifactory-external.vkpartner.ru/artifactory/vkid-sdk-android/" }
maven { url "https://artifactory-external.vkpartner.ru/artifactory/maven/" }
}
}

2. App-Module build.gradle Setup

In your application module's build.gradle / build.gradle.kts file (typically :app), add the required placeholders to the defaultConfig block.

Replace placeholders with the actual credentials provided by your project manager.

Kotlin DSL (build.gradle.kts):

android {
defaultConfig {
// ...

// VK ID SDK Variables
manifestPlaceholders["VKIDClientID"] = "YOUR_CLIENT_ID"
manifestPlaceholders["VKIDClientSecret"] = "YOUR_CLIENT_SECRET"
manifestPlaceholders["VKIDRedirectHost"] = "vk.ru"
manifestPlaceholders["VKIDRedirectScheme"] = "vkYOUR_CLIENT_ID" // Format: "vk" + YOUR_CLIENT_ID
}
}

Groovy DSL (build.gradle):

android {
defaultConfig {
// ...

// VK ID SDK Variables
manifestPlaceholders = [
VKIDClientID: "YOUR_CLIENT_ID",
VKIDClientSecret: "YOUR_CLIENT_SECRET",
VKIDRedirectHost: "vk.ru",
VKIDRedirectScheme: "vkYOUR_CLIENT_ID" // Format: "vk" + YOUR_CLIENT_ID
]
}
}