Skip to content

Hono

Install Kilpi for Hono

Ensure you have setup Kilpi using the quickstart guide before proceeding.

Installing Kilpi for Hono is as easy as providing Kilpi scope within a middleware. You do not need any plugins. We also recommend to set an onUnauthorized handler to throw an HTTPException with a 403 status code.

app.use(async (_, next) => {
Kilpi.runInScope(async () => {
Kilpi.onUnauthorized(({ message }) => {
throw new HTTPException(403, { message })
})
await next();
})
})