Overview
Privy provides user authentication and wallet management solutions for onchain applications. By integrating Privy with Coinbase Wallet, you can access all the Privy hooks and methods while having access to the users of Coinbase Wallet.What You’ll Achieve
By the end of this guide, you will:- Set up Privy with Coinbase Wallet support
- Have Coinbase Wallet set up as the main authentication option
- Be able to access Coinbase Wallet SDK from Privy’s React SDK
Installation
1. Create a New Next.js Project
2. Override the Coinbase Wallet SDK Version
In order to access the latest version of the Coinbase Wallet SDK, you need to override the Privy pinned version in your package.json file. To do this, you can use the following command to override it:3. Install the Dependencies
Install the dependencies with your package manager of choice:Configuration
1. Set Up Environment Variables
Create a.env.local file in your project root:
.env.local
2. Configure Privy Provider
Create your Privy configuration with Coinbase Wallet as the default login method and update the layout to include thePrivyProvider.
Usage
1. Update the App Page
Update theapp/page.tsx file to show the authentication flow:
app/page.tsx
2. Run the Project Locally
You’re done! You can now run the project locally:
3. Get the Coinbase Wallet SDK Instance (Optional)
You can access the Coinbase Wallet SDK from Privy using theuseBaseAccount hook.
Get the SDK instance