# express-api-token-auth

> Secure express with an API token

Latest version **1.0.0** (published 2018-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install express-api-token-auth
pnpm add express-api-token-auth
yarn add express-api-token-auth
bun add express-api-token-auth
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-11-08 |
| First published | 2018-11-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Maximilian Lenkeit |
| Maintainers | mlenkeit |
| Keywords | express, middleware, token, auth, authentication, api, secure |

## Links

- npm: https://www.npmjs.com/package/express-api-token-auth
- Repository: https://github.com/mlenkeit/express-api-token-auth
- Homepage: https://github.com/mlenkeit/express-api-token-auth#readme
- Issues: https://github.com/mlenkeit/express-api-token-auth/issues
- npm.io page: https://npm.io/package/express-api-token-auth

## Dependencies (1)

- [express](https://npm.io/package/express.md) 4.16.4

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@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

## Recent versions

- 1.0.0 (latest) — 2018-11-08

## README

# express-api-token-auth [![Build Status](https://travis-ci.org/mlenkeit/express-api-token-auth.svg?branch=master)](https://travis-ci.org/mlenkeit/express-api-token-auth)

Secure express with an API token

I like to use this approach to secure some personal (i.e. single user) express apps.

## Installation

```shell
$ npm i -SE express-api-token-auth
```

## Usage

```javascript
const express = require('express')
const tokenAuth = require('express-api-token-auth')

const app = express()
app.use(tokenAuth({
  token: 'my-token',
  /* optional */
  onError: (req, res, next, params) => {
    // params.expToken
    // params.actToken
    return res.status(401).send()
  }
}))

// grant access to:
// - query parameter token=my-token
// - HTTP header Authorization:token my-token
```

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