# @node-oauth/oauth2-server

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

Latest version **5.3.0** (published 2026-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @node-oauth/oauth2-server
pnpm add @node-oauth/oauth2-server
yarn add @node-oauth/oauth2-server
bun add @node-oauth/oauth2-server
```

## Health

**Score 60/100 (C)** — status: active.

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

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 5.3.0 |
| Published | 2026-04-15 |
| First published | 2021-10-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=16.0.0 |
| Dependencies | 3 |
| Unpacked size | 143 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 447 |
| Maintainers | jkuester, happyzombies |
| Keywords | oauth, oauth2 |

## Links

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

## Dependencies (3)

- [type-is](https://npm.io/package/type-is.md) 2.0.1
- [basic-auth](https://npm.io/package/basic-auth.md) 2.0.1
- [@node-oauth/formats](https://npm.io/package/@node-oauth/formats.md) 1.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

- 5.3.0 (latest) — 2026-04-15
- 5.2.2-rc.0 (next) — 2026-01-12
- 4.3.3 (maintenance) — 2023-11-07
- 5.2.1 — 2025-07-22
- 5.2.0 — 2024-07-31
- 5.1.0 — 2023-12-14
- 5.1.0-rc.0 — 2023-11-28
- 5.0.0 — 2023-11-06
- 5.0.0-rc.5 — 2023-11-01
- 5.0.0-rc.4 — 2023-09-29
- 5.0.0-rc.3 — 2023-08-29
- 4.3.2 — 2023-08-26
- 4.3.1 — 2023-08-26
- 5.0.0-rc.2 — 2023-08-15
- 5.0.0-rc.1 — 2023-08-02
- … 6 more at https://npm.io/package/@node-oauth/oauth2-server/versions

## README

# @node-oauth/oauth2-server

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

[![Tests](https://github.com/node-oauth/node-oauth2-server/actions/workflows/tests.yml/badge.svg)](https://github.com/node-oauth/node-oauth2-server/actions/workflows/tests.yml)
[![CodeQL Semantic Analysis](https://github.com/node-oauth/node-oauth2-server/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/node-oauth/node-oauth2-server/actions/workflows/codeql-analysis.yml)
[![Tests for Release](https://github.com/node-oauth/node-oauth2-server/actions/workflows/tests-release.yml/badge.svg)](https://github.com/node-oauth/node-oauth2-server/actions/workflows/tests-release.yml)
[![Documentation Status](https://readthedocs.org/projects/node-oauthoauth2-server/badge/?version=latest)](https://node-oauthoauth2-server.readthedocs.io/en/latest/?badge=latest)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![npm Version](https://img.shields.io/npm/v/@node-oauth/oauth2-server?label=version)](https://www.npmjs.com/package/@node-oauth/oauth2-server)
[![npm Downloads/Week](https://img.shields.io/npm/dw/@node-oauth/oauth2-server)](https://www.npmjs.com/package/@node-oauth/oauth2-server)
[![GitHub License](https://img.shields.io/github/license/node-oauth/node-oauth2-server)](https://github.com/node-oauth/node-oauth2-server/blob/master/LICENSE)

NOTE: This project has been forked from [oauthjs/node-oauth2-server](https://github.com/oauthjs/node-oauth2-server) and is a continuation due to the project appearing to be abandoned. Please see [our issue board](https://github.com/node-oauth/node-oauth2-server/issues) to talk about next steps and the future of this project.

## Installation

```bash
npm install @node-oauth/oauth2-server
```

The `@node-oauth/oauth2-server` module is framework-agnostic but there are several officially supported wrappers available for popular HTTP server frameworks such as [Express](https://www.npmjs.com/package/@node-oauth/express-oauth-server) and [Koa (not maintained by us)](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*, *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.
- Support for PKCE
- Complete [test suite](https://github.com/node-oauth/node-oauth2-server/tree/master/test).

## Documentation

Documentation is hosted on Read the Docs. We have multiple versions of the docs available:

- [stable](https://node-oauthoauth2-server.readthedocs.io/en/master/) (master branch)
- [development](https://node-oauthoauth2-server.readthedocs.io/en/development/) (development branch)

Please leave an issue if something is confusing or missing in the docs.

## Examples

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

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

## Version 5 notes

Beginning with version `5.x` we removed dual support for callbacks and promises.
With this version there is only support for Promises / async/await.

With this version we also bumped the `engine` to Node 16 as 14 is now deprecated.

## Migrating from OAuthJs and 3.x

Version 4.x should not be hard-breaking, however, there were many improvements and fixes that may
be incompatible with specific behaviour in <= 3.x

For more info, please read the [changelog](./CHANGELOG.md) or open an issue, if you think something
is unexpectedly not working.

## Supported NodeJs versions

This project supports the node versions along the
[NodeJS LTS releases](https://nodejs.org/en/about/releases/), focusing on

- Maintenance LTS
- Active LTS
- Current

## Contributing to this project

Please read our [contribution guide](./CONTRIBUTING.md) before taking actions.
In any case, please open an issue before opening a pull request to find out whether your intended contribution will actually have a chance to be merged.

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