Skip to content

Oak

Install Kilpi for Oak

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

Installing Kilpi for Oak 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 (ctx, next) => {
Kilpi.runInScope(async () => {
Kilpi.onUnauthorized(({ message }) => {
ctx.throw(403, message);
})
await next();
})
})