# basic-auth-http

> A simple object to implement http basic authentication.

Latest version **0.1.3** (published 2018-04-27) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install basic-auth-http
pnpm add basic-auth-http
yarn add basic-auth-http
bun add basic-auth-http
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2018-04-27 |
| First published | 2018-04-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Valentin Degenne |
| Maintainers | vdegenne |
| Keywords | http, authentication, basic |

## Links

- npm: https://www.npmjs.com/package/basic-auth-http
- Repository: https://github.com/vdegenne/basic-auth-http
- npm.io page: https://npm.io/package/basic-auth-http

## Alternatives

- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads
- [escher-request](https://npm.io/package/escher-request.md) — 545 weekly downloads

## Recent versions

- 0.1.3 (latest) — 2018-04-27
- 0.1.2 — 2018-04-27
- 0.1.1 — 2018-04-27
- 0.1.0 — 2018-04-27

## README

# basic-auth-http

A simple object to implement http basic authentication.

## Usage

```javascript
import {Basic as auth} from 'basic-auth-http';

const app = express();
const auth = new Auth({
  file: '/path/to/user-password-pairs'
});

app.use((req, res, next) => {
  // returns 401 Unauthorized if check doesn't pass (the callback is not called, no next).
  auth.check(req, res, (err: Error) => {
    if (err) {
      next(err);
    }
    else {
      next();
    }
  });
});
```

*You can check the test for more details*

## Installation

```bash
yarn add basic-auth-http
```

## Notes

This is just a bit of code that I wrote for testing and for implementing in a private architecture. Use with caution. If you really want to secure your application you should also make use of https to encrypt the headers because http authorization is sending plain passwords in the request. If you wish to contribute you can propose a PR on the related github, I'd be glad to improve this tiny api.

---
_Source: https://npm.io/package/basic-auth-http · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
