Skip to content
Chained token exchange for OAuth2orize.
JavaScript
Find file
Latest commit 6d102fe @jaredhanson Bump to version 0.1.0.
Failed to load latest commit information.
lib Add comments.
support/mk Initial commit.
test Delint tests.
.gitignore Initial commit.
.jshintrc Initial commit.
.npmignore Initial commit.
.travis.yml Disable node 0.6 on Travis CI.
LICENSE Initial commit.
Makefile Stub out test cases.
README.md Update README.
package.json Bump to version 0.1.0.

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

Something went wrong with that request. Please try again.