Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.37 KB

README.md

File metadata and controls

46 lines (33 loc) · 1.37 KB

Privy Auth create-next-app Starter

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.

Setup

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

yourPRIVYapplocalhost

Check out:

  • pages/_app.tsx for how to use the PrivyProvider and initialize it with your Privy App ID
  • pages/index.tsx for how to use the usePrivy hook and implement a simple login button
  • pages/dashboard.tsx for how to use the usePrivy hook, fields like ready, authenticated, and user, and methods like linkWallet and logout

Check out our docs for more guidance around using Privy in your app!