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

Overview

Privy provides user authentication and wallet management solutions for web3 applications. By integrating Privy with Base Account, you can offer users a smooth onboarding experience with embedded wallets and Base Account functionality.

What you’ll achieve

By the end of this guide, you will:
  • Set up Privy with Base Account support
  • Configure embedded wallets for your users
  • Enable Base Account as a wallet option

Installation

After creating a new Next.js project, install the required dependencies:

Configuration

1. Set up Environment Variables

Create a .env.local file in your project root:
Get your Privy App ID from the Privy Dashboard.

2. Configure Privy Provider

Create your Privy configuration with Base Account support:
To have Sign in with Base as a top level sign in option in the login modal, modify your privyConfig to include base_account in the loginMethodsAndOrder field.

3. Create Authentication Hook

Create a custom hook to manage authentication state:

4. Create Login Component

Create a component to handle user authentication:

5. Wallet Connection Component

Create a component to manage wallet connections:

Testing Your Setup

Create a simple page to test your Privy + Base Account integration:

Next Steps

Now that you have Privy configured with Base Account, you can:

Additional Configuration

Customizing Login Methods

You can customize which login methods are available:

Styling and Branding

Customize the appearance to match your brand: