Prevent unauthorized access to routes using RBAC
call-protected-route
as the name and add a description if you want.admin
and select the permission from the prevous step1 git clone git@github.com:unkeyed/examples.git2 cd examples/express-with-middleware-permissions
1 pnpm install
.env
file and add the following:1 UNKEY_ROOT_KEY=your-root-key2 UNKEY_API_ID=your-api-id
1 pnpm dev
1 curl http://localhost:3000/public
It should return Hello world!
1 curl http://localhost:3000/protected -H "Authorization: Bearer <YOUR_KEY>"
It should return Hello protected world!