# oauth2-server

> Complete, framework-agnostic, compliant and well tested module for implementing an OAuth2 Server in node.js

Latest version **3.1.1** (published 2020-07-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install oauth2-server
pnpm add oauth2-server
yarn add oauth2-server
bun add oauth2-server
```

## Health

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

Positive: has types package; high quality score.

Warnings: low downloads; no esm support; has vulnerabilities.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.1 |
| Published | 2020-07-14 |
| First published | 2014-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/oauth2-server) |
| Module format | CommonJS |
| Node | >=4.0 |
| Dependencies | 6 |
| Unpacked size | 260.3 KB |
| Known vulnerabilities | 2 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4063 |
| Maintainers | mjsalinger, nunofgs, ruimarinho, thomseddon |
| Keywords | oauth, oauth2 |

## Links

- npm: https://www.npmjs.com/package/oauth2-server
- Repository: https://github.com/oauthjs/node-oauth2-server
- Homepage: https://github.com/oauthjs/node-oauth2-server#readme
- Issues: https://github.com/oauthjs/node-oauth2-server/issues
- npm.io page: https://npm.io/package/oauth2-server

## Dependencies (6)

- [lodash](https://npm.io/package/lodash.md) 4.17.19
- [type-is](https://npm.io/package/type-is.md) 1.6.18
- [bluebird](https://npm.io/package/bluebird.md) 3.7.2
- [statuses](https://npm.io/package/statuses.md) 1.5.0
- [basic-auth](https://npm.io/package/basic-auth.md) 2.0.1
- [promisify-any](https://npm.io/package/promisify-any.md) 2.0.1

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

- 3.1.1 (latest) — 2020-07-14
- 4.0.0-dev.3 (dev) — 2021-06-07
- 3.1.0-beta.1 (next) — 2018-08-27
- 3.1.0 — 2020-07-01
- 3.1.0-rc1 — 2020-06-27
- 3.0.2 — 2020-05-24
- 4.0.0-dev.2 — 2018-09-05
- 4.0.0-dev.1 — 2018-08-27
- 3.0.1 — 2018-08-27
- 3.0.0 — 2017-08-09
- 3.0.0-b4 — 2017-04-26
- 3.0.0-b3.1 — 2016-11-12
- 3.0.0-b3 — 2016-11-10
- 3.0.0-b2 — 2016-03-02
- 3.0.0-b1 — 2016-03-02
- … 4 more at https://npm.io/package/oauth2-server/versions

## README

# oauth2-server

[![npm Version][npm-image]][npm-url]
[![npm Downloads][downloads-image]][downloads-url]
[![Test Status][travis-image]][travis-url]
[![MIT Licensed][license-image]][license-url]
[![oauthjs Slack][slack-image]][slack-url]

Complete, compliant and well tested module for implementing an OAuth2 server in [Node.js](https://nodejs.org).

Note: After a period of hiatus, this project is now back under active maintenance. Dependencies have been updated and bug fixes will land in v3 (current master). v4 will be _mostly backwards compatible_ with no code changes required for users using a supported node release. More details in [#621](https://github.com/oauthjs/node-oauth2-server/issues/621).

## Installation

```bash
npm install oauth2-server
```

The *oauth2-server* module is framework-agnostic but there are several officially supported wrappers available for popular HTTP server frameworks such as [Express](https://npmjs.org/package/express-oauth-server) and [Koa](https://npmjs.org/package/koa-oauth-server). If you're using one of those frameworks it is strongly recommended to use the respective wrapper module instead of rolling your own.


## Features

- Supports `authorization_code`, `client_credentials`, `refresh_token` and `password` grant, as well as *extension grants*, with scopes.
- Can be used with *promises*, *Node-style callbacks*, *ES6 generators* and *async*/*await* (using [Babel](https://babeljs.io)).
- Fully [RFC 6749](https://tools.ietf.org/html/rfc6749.html) and [RFC 6750](https://tools.ietf.org/html/rfc6750.html) compliant.
- Implicitly supports any form of storage, e.g. *PostgreSQL*, *MySQL*, *MongoDB*, *Redis*, etc.
- Complete [test suite](https://github.com/oauthjs/node-oauth2-server/tree/master/test).


## Documentation

[Documentation](https://oauth2-server.readthedocs.io) is hosted on Read the Docs.


## Examples

Most users should refer to our [Express](https://github.com/oauthjs/express-oauth-server/tree/master/examples) or [Koa](https://github.com/oauthjs/koa-oauth-server/tree/master/examples) examples.

More examples can be found here: https://github.com/14gasher/oauth-example

## Upgrading from 2.x

This module has been rewritten using a promise-based approach, introducing changes to the API and model specification. v2.x is no longer supported.

Please refer to our [3.0 migration guide](https://oauth2-server.readthedocs.io/en/latest/misc/migrating-v2-to-v3.html) for more information.


## Tests

To run the test suite, install dependencies, then run `npm test`:

```bash
npm install
npm test
```


[npm-image]: https://img.shields.io/npm/v/oauth2-server.svg
[npm-url]: https://npmjs.org/package/oauth2-server
[downloads-image]: https://img.shields.io/npm/dm/oauth2-server.svg
[downloads-url]: https://npmjs.org/package/oauth2-server
[travis-image]: https://img.shields.io/travis/oauthjs/node-oauth2-server/master.svg
[travis-url]: https://travis-ci.org/oauthjs/node-oauth2-server
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg
[license-url]: https://raw.githubusercontent.com/oauthjs/node-oauth2-server/master/LICENSE
[slack-image]: https://slack.oauthjs.org/badge.svg
[slack-url]: https://slack.oauthjs.org

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