1.0.0 • Published 8 years ago

koa-ctx-basic-auth v1.0.0

Weekly downloads
17
License
MIT
Repository
github
Last release
8 years ago

Koa Context Basic Auth

NPM version Build status Test coverage Dependency Status License Downloads

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()
})