Chained token exchange for OAuth2orize.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
support/mk
test
.gitignore
.jshintrc
.npmignore
.travis.yml
LICENSE
Makefile
README.md
package.json

README.md

oauth2orize-chain

Build Coverage Quality Dependencies Tips

Chained token exchange for OAuth2orize.

This exchange is used to exchange an access token issued by an OAuth domain for a chained access token, potentially issued by a different OAuth domain. This scenario facilitiates service chaining, in which one service needs to communicate with another service in order to fulfill the original request.

Install

$ npm install oauth2orize-chain

Usage

Register Exchange

Register the exchange with an OAuth 2.0 server.

var chain = require('oauth2orize-chain').exchange.chain;

server.exchange('http://oauth.net/grant_type/chain', chain(function(client, scheme, credential, scope, done) {
  AccessToken.verify(credential, function(err, t) {
    if (err) { return done(err); }

    var token = utils.uid(256);
    var at = new AccessToken(token, t.userId, client.id, t.scope);
    at.save(function(err) {
      if (err) { return done(err); }
      return done(null, token);
    });
  });
});

Implementation

This module is implemented based on Chain Grant Type for OAuth2, Draft 01. Implementers are encouraged to track the progress of this specification and update update their implementations as necessary. Furthermore, the implications of relying on a non-final draft specification should be understood prior to deployment.

Related Modules

Tests

$ npm install
$ npm test

Credits

License

The MIT License

Copyright (c) 2014 Jared Hanson <http://jaredhanson.net/>