Overview
Privy provides user authentication and wallet management solutions for onchain applications. By integrating Privy with Base Account, you can access all the Privy hooks and methods while having access to the users of Base Account.What you’ll achieve
By the end of this guide, you will:- Set up Privy with Base Account support
- Have Base Account set up as the main authentication option
- Be able to access Base Account SDK from Privy’s React SDK
Base Account Privy Templatehttps://github.com/base/base-account-privy
Installation
After creating a new Next.js project, install the required dependencies:Access the latest version of the Base Account SDK (Recommended)It is to access the latest version of the Base Account SDK in order to get the latest features and bug fixes.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:Make sure to delete your
node_modules
and package-lock.json
and run a new install to ensure the overrides are applied.Configuration
1. Set up Environment Variables
Create a.env.local
file in your project root:
2. Configure Privy Provider
Create your Privy configuration with Base Account and email as login methods:3. Access Base Account SDK from Privy
You can access the Base Account SDK from Privy using theuseBaseAccount
hook.
Get the SDK instance