# @oddnetworks/express-auth-request

> Middleware for decoding access and authorization tokens

Latest version **1.0.0** (published 2016-01-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install @oddnetworks/express-auth-request
pnpm add @oddnetworks/express-auth-request
yarn add @oddnetworks/express-auth-request
bun add @oddnetworks/express-auth-request
```

## 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 | 2016-01-25 |
| First published | 2016-01-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| Author | Blain Smith |
| Maintainers | blainsmith |

## Links

- npm: https://www.npmjs.com/package/@oddnetworks/express-auth-request
- npm.io page: https://npm.io/package/@oddnetworks/express-auth-request

## Dependencies (4)

- [boom](https://npm.io/package/boom.md) ^3.1.2
- [lodash](https://npm.io/package/lodash.md) ^4.0.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.1.1
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^5.5.4

## Recent versions

- 1.0.0 (latest) — 2016-01-25

## README

# express-auth-request

Middleware for authorizing requests to Odd resources.

## Install (WIP)
```
npm install @oddnetworks/express-auth-request
```

## Usage

This middleware exposed 2 separate methods to to handle the `X-Access-Token` and the `Authorization` headers and makes Seneca calls to the right resources to validate and decorate the requests accordingly.

```js
const config = require('./config');
const seneca = require('seneca')();
const express = require('express');

const authRequest = require('express-auth-request');

// Protect all resources with x-access-token
app.use(authRequest.accessToken({secret: config.JWTSecret, seneca: seneca}));

// Protect certain routes based on entityId with user specific Authorization
app.get('/videos/:entityId', authRequest.authorizationToken({secret: config.JWTSecret, seneca: seneca}));
```

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