This is a template for integrating Privy Auth into a NextJS project. Check out the deployed app here!
This demo uses NextJS's Pages Router. If you'd like to see an example using the App Router, just change the branch of this repository to app-router
.
git clone https://github.com/BRAINCHN/privy2
npm i
npm install @privy-io/react-auth@latest
enable localhost:3000 in the domain allow list
npm run dev
cp .env.example .env.local
```.env
# Add Privy App ID to .env.local
NEXT_PUBLIC_PRIVY_APP_ID=yourprivyappIDgoeshere
PRIVY_APP_SECRET=yourprivyappsecretkeygoeshere
npm run dev
pages/_app.tsx
for how to use thePrivyProvider
and initialize it with your Privy App IDpages/index.tsx
for how to use theusePrivy
hook and implement a simplelogin
buttonpages/dashboard.tsx
for how to use theusePrivy
hook, fields likeready
,authenticated
, anduser
, and methods likelinkWallet
andlogout
Check out our docs for more guidance around using Privy in your app!