Prerequisites
- Created your Unkey account
- Created an API in the Unkey dashboard
Skip the tutorial
We also have a Next.js example ready to deploy on Vercel.
1
Create Next.js Application
Run the following command to init your Next.js project
2
Install
Now install the
@unkey/nextjs package3
Creating a protected route
Create a new route and add the following code
/app/protected/route.ts
4
Running it
5
Try it out
Go to https://app.unkey.com and create a new key. Then verify it with our new server:It should return Log may potentially have more information about the key, depending on what you set up in the dashboard.
"Your API key is valid!" and log out the following.