Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Auth.js · Const

Vk

Vk is Auth.js’s built-in VK OAuth provider. Add it to the providers list, configure VK credentials, and optionally override its default API-version endpoints.

How it works

Vk is a built-in OAuth provider factory for Auth.js. Add it to the framework configuration, provide VK client credentials through environment variables, and optionally pass provider options when changing the default VK API version or endpoint settings.

Syntax

Vk(options?)

Returns

A configured Auth.js VK provider usable in the providers array.

Key points

  • Vk adds VK as an OAuth login option in an Auth.js application.
  • The provider supplies default OAuth configuration, so common integrations only need the provider and credentials.
  • Auth.js treats VK as an OAuth 2 provider by default.
  • The default VK API version is 5.126.
  • Version-specific behavior can be configured through the provider options.

Common mistakes

  • The provider defaults to VK API version 5.126; override the provider endpoint URLs if your integration requires another version.
  • A custom API version is not set globally; pass version-specific URL overrides in the Vk options object.

Example: Configure VK sign-in

import NextAuth from "next-auth"
import Vk from "next-auth/providers/vk"

export const { handlers, auth, signIn, signOut } = NextAuth({
  providers: [Vk],
})

Register the VK provider in a NextAuth configuration; supply the required credentials through the documented environment variables.

When to use it

VK OAuth login

Users sign in to an application with their VK accounts.

Custom VK API version

An application must target a VK API release other than the default.

Framework integration

A framework-specific Auth.js configuration needs VK authentication.

Interview questions

QHow do you enable VK authentication in Next.js?

Vk is the built-in Auth.js provider for VK OAuth login. In a Next.js setup, import it from next-auth/providers/vk and include it in the providers array.

Follow-up: How would you adapt it for another framework? Use that framework’s Auth.js integration and import its corresponding VK provider module, such as the provider shown for that integration.

QWhat callback URL should be registered for VK in Next.js?

The VK callback endpoint is https://example.com/api/auth/callback/vk for a typical Next.js deployment. The VK application must be configured to redirect to the matching callback URL for the deployed application.

Follow-up: What must change for another integration? Use the callback path documented for that framework rather than assuming the Next.js route.

QHow can you use a different VK API version?

The provider uses VK API version 5.126 by default. To use another version, provide customized access-token, request-token, authorization, and profile URLs containing the selected version.

Follow-up: Which endpoints need coordinated changes? Update all four provider URL overrides together so authorization, token exchange, and profile retrieval target the same API version.

  • OAuth Providers
  • Configuring OAuth Providers
  • Auth.js
  • NextAuth

Source: Vk. Checked 2026-10-15.