Skip to content

Wardormeur/hapijs-oauth-server

 
 

Repository files navigation

Hapi OAuth Server Build Status

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

This is the Hapi wrapper for oauth2-server.

Installation

// Not yet published :>
$ npm install Hapi-oauth-server

Quick Start

var Hapi = require('Hapi');
app = new hapi.Server();
app.connection({ port: 3000 });
app.register({register: plugin, options: {
  model: {} // See https://github.com/thomseddon/node-oauth2-server for specification
}}, function (err) {
  // Do smthing w/ the error :)
});
app.route({method: 'GET', path: '/authenticate', handler: {'oauth2-authenticate': {}}});
app.route({method: 'GET', path: '/authorize', handler: {'oauth2-authorize': {}}});
app.route({method: 'GET', path: '/token', handler: {'oauth2-token': {}}});

Options

var options = {
  useErrorHandler: false, // Not yet tested from the express module
  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 Hapi 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()

About

Not complete, compliant and relatively well tested module for implementing an OAuth2 Server/Provider with hapijs in node.js

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%