This project demonstrates an example flow for setting up an authentication flow using the sign-in with ethereum spec via the thirdweb SDK.
It implements a backend endpoint with an admin wallet to generate and verify signatures as a form of authentication, and a react frontend to enable a user on the client side to connect and authenticate with their wallet.
To run the project, first clone this repository, and then run one of the following commands to install the dependencies:
npm install
# or
yarn installNext, you need to create a .env.local file and add the ADMIN_PRIVATE_KEY variable to it with the private key of the wallet you want to use as the admin wallet to generate and verify payloads. Your file should use something like the following:
ADMIN_PRIVATE_KEY=...Finally, you can run the project with one of the following commands:
npm run dev
# or
yarn devNow, you can navigate to http://localhost:3000 to visit the client side page where you can connect a wallet, sign-in with ethereum and view the payload, and use the payload to authenticate with the backend.
To learn more about thirdweb and Next.js, take a look at the following resources:
- thirdweb React Documentation - learn about our React SDK.
- thirdweb TypeScript Documentation - learn about our JavaScript/TypeScript SDK.
- thirdweb Portal - check our guides and development resources.
- Next.js Documentation - learn about Next.js features and API.
You can check out the thirdweb GitHub organization - your feedback and contributions are welcome!
For any questions, suggestions, join our discord at https://discord.gg/thirdweb.