npm/node-oauth2-server

Name: node-oauth2-server

Owner: npm

Description: Complete, compliant and well tested module for implementing an OAuth2 Server/Provider with express in node.js

Forked from: oauthjs/node-oauth2-server

Created: 2016-03-29 20:22:01.0

Updated: 2018-01-22 18:47:00.0

Pushed: 2016-03-29 20:34:24.0

Homepage: https://npmjs.org/package/node-oauth2-server

Size: 463

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Complete, compliant and well tested module for implementing an OAuth2 server in node.js.

NPM Version Build Status NPM Downloads

Quick Start

The node-oauth2-server module is framework-agnostic but there are several wrappers available for popular frameworks such as express and koa.

Using the express wrapper (recommended):

express = require('express');
oauthserver = require('express-oauth-server');
app = express();

oauth = new oauthServer({ model: model });

use(oauth.authenticate());

get('/', function (req, res) {
s.send('Hello World');


listen(3000);

Using this module directly (for custom servers only):

Request = require('oauth2-server').Request;
oauthServer = require('oauth2-server');

oauth = new oauthServer({ model: model });

request = new Request({
aders: { authorization: 'Bearer foobar' }


h.authenticate(request)
hen(function(data) {
// Request is authorized.

atch(function(e) {
// Request is not authorized.
;

Note: see the documentation for the specification of what's required from the model.

Features

Documentation

Examples

Most users should refer to our express or koa examples. If you're implementing a custom server, we have many examples available:

Upgrading from 2.x

This module has been rewritten with a promise-based approach and introduced a few changes in the model specification.

Please refer to our 3.0 migration guide for more information.

License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.