This example demonstrates how to use thirdweb Auth with NextJS.
To run the project, first clone this repository, and then run one of the following commands to install the dependencies:
npm install
# or
yarn install
Next, you need to create a .env.local
file and set the THIRDWEB_AUTH_PRIVATE_KEY
variable to the admin private key you want to use for Auth, as well as the NEXT_PUBLIC_THIRDWEB_AUTH_DOMAIN
variable to the domain you want to use for Auth. Your .env.local
file should look like the following:
THIRDWEB_AUTH_PRIVATE_KEY=...
NEXT_PUBLIC_THIRDWEB_AUTH_DOMAIN=example.com
Finally, you can run the project with one of the following commands:
npm run dev
# or
yarn dev
Now, 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, take a look at the following resources:
- thirdweb Auth Documentation - learn about thirdweb Auth.
- thirdweb React Documentation - learn about our React SDK.
- thirdweb Portal - check our guides and development resources.
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.