koa-ctx-basic-auth
v1.0.0
Published
Augments Koa with ctx.basicAuth
Downloads
1,118
Maintainers
Readme
Koa Context Basic Auth
Augments Koa with const { name, pass } = ctx.basicAuth
and ctx.request.basicAuth
.
Example
const Koa = require('koa')
const app = new Koa()
require('koa-ctx-basic-auth')(app)
app.use(async (ctx, next) => {
const { name, pass } = ctx.basicAuth
// OR
const { name, pass } = ctx.request.basicAuth
await next()
})