Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koajs/ctx-basic-auth
Augments Koa with ctx.basicAuth
https://github.com/koajs/ctx-basic-auth
Last synced: 2 months ago
JSON representation
Augments Koa with ctx.basicAuth
- Host: GitHub
- URL: https://github.com/koajs/ctx-basic-auth
- Owner: koajs
- License: mit
- Created: 2016-06-19T03:35:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T20:08:07.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T13:08:39.365Z (8 months ago)
- Language: JavaScript
- Size: 29.3 KB
- Stars: 5
- Watchers: 7
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-koa - ctx-basic-auth - Augments Koa with ctx.basicAuth (Middleware)
README
# Koa Context Basic Auth
[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![Greenkeeper badge](https://badges.greenkeeper.io/koajs/ctx-basic-auth.svg)](https://greenkeeper.io/)
[![Dependency Status][david-image]][david-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]Augments Koa with `const { name, pass } = ctx.basicAuth` and `ctx.request.basicAuth`.
## Example
```js
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.basicAuthawait next()
})
```[npm-image]: https://img.shields.io/npm/v/koa-ctx-basic-auth.svg?style=flat-square
[npm-url]: https://npmjs.org/package/koa-ctx-basic-auth
[travis-image]: https://img.shields.io/travis/koajs/ctx-basic-auth/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/koajs/ctx-basic-auth
[codecov-image]: https://img.shields.io/codecov/c/github/koajs/ctx-basic-auth/master.svg?style=flat-square
[codecov-url]: https://codecov.io/github/koajs/ctx-basic-auth
[david-image]: http://img.shields.io/david/koajs/ctx-basic-auth.svg?style=flat-square
[david-url]: https://david-dm.org/koajs/ctx-basic-auth
[license-image]: http://img.shields.io/npm/l/koa-ctx-basic-auth.svg?style=flat-square
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/koa-ctx-basic-auth.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/koa-ctx-basic-auth