Skip to main content

providers/vk

Built-in VK integration.

default()​

default<P>(options): OAuthConfig< P >

Add VK login to your page.

Setup​

Callback URL​

https://example.com/api/auth/callback/vk

Configuration​

import Auth from "@auth/core"
import VK from "@auth/core/providers/vk"

const request = new Request(origin)
const response = await Auth(request, {
providers: [VK({ clientId: VK_CLIENT_ID, clientSecret: VK_CLIENT_SECRET })],
})

Resources​

Notes​

By default, Auth.js assumes that the VK provider is based on the OAuth 2 specification.

tip

The VK provider comes with a default configuration. To override the defaults for your use case, check out customizing a built-in OAuth provider.

note

By default the provider uses 5.126 version of the API. See https://vk.com/dev/versions for more info. If you want to use a different version, you can pass it to provider's options object:

pages/api/auth/[...nextauth].js
const apiVersion = "5.126"
providers: [
VkProvider({
accessTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`,
requestTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`,
authorizationUrl:
`https://oauth.vk.com/authorize?response_type=code&v=${apiVersion}`,
profileUrl: `https://api.vk.com/method/users.get?fields=photo_100&v=${apiVersion}`,
})
]
Disclaimer

If you think you found a bug in the default configuration, you can open an issue.

Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, we might not pursue a resolution. You can ask for more help in Discussions.

Type parameters​

β–ͺ P extends Record< string, any > = VkProfile

Parameters​

β–ͺ options: OAuthUserConfig< P >

Returns​

OAuthConfig< P >


VkProfile​

https://dev.vk.com/reference/objects/user