Authentication and authorization
This a starter AdonisJS application which implements API key verification with Unkey RBAC. There are two endpoints, a public one and a protected one that requires a valid API Key.
API ID
.Clone the repository:
1git clone https://github.com/Ionfinisher/unkey-adonisjs-template.git
Navigate to the project directory:
1cd <project-directory>
Install the dependencies:
1npm install
Change the .env.example to .env file and add the following:
1UNKEY_ROOT_KEY=your-root-key2UNKEY_API_ID=your-api-id
Get the root key from https://app.unkey.com/settings/root-keys
Start the server
1cd to the root of the project directory2node ace serve --watch
curl the unprotected route
1 curl http://127.0.0.1:3333/api/v1/public
It should return Heeyaaa!! Touchdown to the public endpoint!!
curl the protected route
1 curl http://127.0.0.1:3333/api/v1/protected -H "Authorization: Bearer <YOUR_KEY>"
It should return Woohoo!! Touchdown to the protected endpoint!!
This project is licensed under the MIT License.
For further information, go to unkey.
2500 verifications and 100K successful rate‑limited requests per month. No CC required.