Skip to main content

ВКонтакте (vKontakte) Login with Web3Auth

note

vKontakte login can be performed in various ways, depending on the use case. We have demonstrated this with Auth0, but this can be done with any other Federated/JWT providers.

Create a ВКонтакте (vKontakte) verifier

  • Go to the Web3Auth dashboard and select your project. Click on the Custom Authentication tab, then click on the Create Verifier button to create a new verifier.

    Custom Authentication Dashboard

  1. Create a verifier for your Auth0 application by selecting Auth0 as the Login provider from this modal. ВКонтакте (vKontakte) - Login Providers list on Web3Auth
Dashboard 2. Select the Other as the Authentication Type based on the dropdown. ВКонтакте (vKontakte) - Auth0 Authentication Type
list on Web3Auth Dashboard 3. Enter the Auth0 Client ID and Auth0 Domain from your Auth0 application. See how to create a new Auth0 application here.

ВКонтакте (vKontakte) - Domain and Client ID from Auth0 Dashboard ВКонтакте (vKontakte) - Auth0 Client ID and Auth0 Domain on Web3Auth Dashboard

  1. Add the ВКонтакте (vKontakte) Social Connection to your Auth0 application.
  2. Click on the Create button to create ВКонтакте (vKontakte) Custom Authentication via Auth0 verifier.

Example

import { AuthAdapter } from "@web3auth/auth-adapter";

// Create AuthAdapter instance once you have created Web3AuthNoModal instance
const authAdapter = new AuthAdapter({
adapterSettings: {
uxMode: "redirect",
loginConfig: {
jwt: {
verifier: "w3a-auth0-uk-demo", // Pass the Verifier name here
typeOfLogin: "jwt", // Pass on the login provider of the verifier you've created
clientId: "OfDAVldBEGslU9wjiWyQ1LPWOWNnnzim", // Pass on the Auth0 `Client ID` here
},
},
},
});

web3AuthInstance.configureAdapter(authAdapter);

// Initialize
await web3AuthInstance.init();

// Login with ВКонтакте (vKontakte)
await web3AuthInstance.connectTo(WALLET_ADAPTERS.AUTH, {
loginProvider: "jwt",
extraLoginOptions: {
domain: "https://web3auth.uk.auth0.com", // Pass on the Auth0 `Domain` here
verifierIdField: "sub", // Pass on the field name of the `sub` field in the JWT
connection: "vkontakte", // Use this to skip Auth0 Modal for ВКонтакте (vKontakte) login
},
});