This is a minimal template for integrating Privy Auth into a new create-react-app
project. Check out the deployed app here!
- Clone this repository and open it in your terminal.
git clone https://github.com/privy-io/create-react-app.git
- Install the necessary dependencies (including Privy Auth) with
npm
.
npm i
- Initialize your environment variables by copying the
.env.example
file to an.env
file. Then, paste your Privy App ID from the console in.env
.
# In your terminal, create .env from .env.example
cp .env.example .env
# Add your Privy App ID to .env
REACT_APP_PRIVY_APP_ID=<your-privy-app-id>
In your project directory, run npm run start
. You can now visit http://localhost:3000 to see your app and login with Privy!
src/index.js
for how to use thePrivyProvider
and initialize it with your Privy App IDsrc/App.js
for how to use theusePrivy()
hook, fields likeauthenticated
anduser
, and methods likelogin
andlogout
config-overrides.js
for how to handle common issues with Webpack 5
Check out our docs for more guidance around using Privy in your app!