VeChain Kit: Social Login & Smart Accounts
Add Social Login
Set up social login using VeChainKit by adding the WalletButton, wrapping your app with VeChainKitProvider, and configuring environment variables with WalletConnect.
Adding WalletButton to Your App Header
We'll be adding the social login to the header of our app. In your header, add the WalletButton component from the VeChain Kit.
Your header should now look like this:
Wrapping Your App with the VeChainKit Provider
To enable wallet login, blockchain access, and VeChainKit hooks across your entire app, you need to wrap your app with the VeChainKitProvider.
First, create a VeKitProvider.tsx in your utils folder.
This is where you should include the following code:
This makes wallet data, hooks, and UI components work across your app.
The next important thing is to create the NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID.
Create an .env file. Here, you’ll need to add the environment variables to make this work. First, start by adding NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID.
Go to https://cloud.reown.com/sign-in to get your wallet connect project ID.
Once you’ve made your Reown account, create a Testnet app.
Navigate to the Reown Cloud dashboard to get the Project ID.
Add the project ID to the .env file.
Finally, all you have to do is go to your layout.tsx where you need to import the VeChainKitProviderWrapper as well as the AppHeader from utils/header.
Add VeChainKitProviderWrapper to the <body> in layout.tsx:
And that’s all we need for now. In the next lesson, you’ll look at Fee Delegation as a final step to include social login in your app.
Debugging Tip: TypeScript “any” Error
If you see this error:
It means TypeScript is expecting a defined prop type for children. To resolve this, import ReactNode from "react" into your VeChainKitProvider.tsx file:
Join our Telegram