# express-oauth-server

> OAuth provider for express

Latest version **2.0.0** (published 2017-08-09) · SEE LICENSE IN LICENSE license · 0 weekly downloads

## Install

```sh
npm install express-oauth-server
pnpm add express-oauth-server
yarn add express-oauth-server
bun add express-oauth-server
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2017-08-09 |
| First published | 2016-02-09 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE |
| TypeScript types | separate (@types/express-oauth-server) |
| Module format | CommonJS |
| Node | >=0.11 |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | Nuno Sousa |
| Maintainers | mjsalinger, nunofgs |
| Keywords | express, oauth, oauth2 |

## Links

- npm: https://www.npmjs.com/package/express-oauth-server
- Repository: https://github.com/seegno/express-oauth-server
- Homepage: https://github.com/seegno/express-oauth-server#readme
- Issues: https://github.com/seegno/express-oauth-server/issues
- npm.io page: https://npm.io/package/express-oauth-server

## Dependencies (3)

- [express](https://npm.io/package/express.md) ^4.13.3
- [bluebird](https://npm.io/package/bluebird.md) ^3.0.5
- [oauth2-server](https://npm.io/package/oauth2-server.md) 3.0.0

## 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

- 2.0.0 (latest) — 2017-08-09
- 2.0.0-b3 (next) — 2017-05-02
- 2.0.0-b2 — 2016-12-21
- 2.0.0-b1 — 2016-11-11
- 1.0.0 — 2016-02-09

## README

# Express OAuth Server [![Build Status](https://travis-ci.org/oauthjs/express-oauth-server.png?branch=master)](https://travis-ci.org/oauthjs/express-oauth-server)

Complete, compliant and well tested module for implementing an OAuth2 Server/Provider with [express](https://github.com/expressjs/express) in [node.js](http://nodejs.org/).

This is the express wrapper for [oauth2-server](https://github.com/oauthjs/node-oauth2-server).

## Installation

    $ npm install express-oauth-server

## Quick Start

The module provides two middlewares - one for granting tokens and another to authorize them. `express-oauth-server` and, consequently `oauth2-server`, expect the request body to be parsed already.
The following example uses `body-parser` but you may opt for an alternative library.

```js
var bodyParser = require('body-parser');
var express = require('express');
var OAuthServer = require('express-oauth-server');

var app = express();

app.oauth = new OAuthServer({
  model: {}, // See https://github.com/oauthjs/node-oauth2-server for specification
});

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(app.oauth.authorize());

app.use(function(req, res) {
  res.send('Secret area');
});

app.listen(3000);
```

## Options

```
var options = { 
  useErrorHandler: false, 
  continueMiddleware: false,
}
```
* `useErrorHandler`
(_type: boolean_ default: false)

  If false, an error response will be rendered by this component.
  Set this value to true to allow your own express error handler to handle the error.

* `continueMiddleware`
(_type: boolean default: false_)

  The `authorize()` and `token()` middlewares will both render their 
  result to the response and end the pipeline.
  next() will only be called if this is set to true.

  **Note:** You cannot modify the response since the headers have already been sent.

  `authenticate()` does not modify the response and will always call next()

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