VK OAuth login
Users sign in to an application with their VK accounts.
Auth.js · Const
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.
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.
Vk(options?)A configured Auth.js VK provider usable in the providers array.
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.
Users sign in to an application with their VK accounts.
An application must target a VK API release other than the default.
A framework-specific Auth.js configuration needs VK authentication.
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.
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.
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 ProvidersConfiguring OAuth ProvidersAuth.jsNextAuth