oauth2orize-jwt-to-bearer

2.0.2 • Public • Published

oauth2orize-jwt-to-bearer

JSON Web Token (JWT) Profile for OAuth 2.0 Authorization Grants Exchange Middleware for OAuth2orize

Install

$ yarn install oauth2orize-jwt-to-bearer

Usage

Register Exchange Middleware

This exchange middleware is used to by clients to request an access token by using a JSON Web Token (JWT) generated by the client and verified by a Public Key stored on the OAuth 2.0 server. The exchange requires a verify callback, which accepts the client, scope and assertion(JWT), then calls done providing a access token.

var jwtBearer = require('oauth2orize-jwt-to-bearer').Exchange;
 
server.exchange('urn:ietf:params:oauth:grant-type:jwt-bearer', jwtBearer(function(client, scope, assertion, done) {
 
   AccessToken.create(client, scope, function(err, accessToken) {
     if (err) { return done(err); }
     done(null, accessToken);
   });
}));

Tests

$ yarn install --dev
$ yarn test

License

The MIT License

Dependents (0)

Package Sidebar

Install

npm i oauth2orize-jwt-to-bearer

Weekly Downloads

2

Version

2.0.2

License

SEE LICENSE IN LICENSE

Unpacked Size

18.5 kB

Total Files

16

Last publish

Collaborators

  • mdemers