Skip to main content
Learn how to set up Privy with Coinbase Wallet to enable seamless user authentication and wallet management.

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
You can jump ahead and use the Coinbase Wallet Privy Template to get started.

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:
Or you can use a specific version by adding the version to the overrides:
If you’re not starting a new projectsMake sure to delete your node_modules and package-lock.json and run a new install to ensure the overrides are applied.

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
Get your Privy App ID from the Privy Dashboard.

2. Configure Privy Provider

Create your Privy configuration with Coinbase Wallet as the default login method and update the layout to include the PrivyProvider.

Usage

1. Update the App Page

Update the app/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:
You should see a page that looks like this:
Base × Privy Demo

3. Get the Coinbase Wallet SDK Instance (Optional)

You can access the Coinbase Wallet SDK from Privy using the useBaseAccount hook.
Get the SDK instance