passport-oauth2
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -164,10 +164,8 @@ /** | ||
} | ||
// NOTE: The module oauth (0.9.5), which is a dependency, automatically adds | ||
// a 'type=web_server' parameter to the percent-encoded data sent in | ||
// the body of the access token request. This appears to be an | ||
// artifact from an earlier draft of OAuth 2.0 (draft 22, as of the | ||
// time of this writing). This parameter is not necessary, but its | ||
// presence does not appear to cause any issues. | ||
this._oauth2.getOAuthAccessToken(code, { grant_type: 'authorization_code', redirect_uri: callbackURL }, | ||
var params = this.tokenParams(options); | ||
params.grant_type = 'authorization_code'; | ||
params.redirect_uri = callbackURL; | ||
this._oauth2.getOAuthAccessToken(code, params, | ||
function(err, accessToken, refreshToken, params) { | ||
@@ -208,8 +206,2 @@ if (err) { return self.error(self._createOAuthError('Failed to obtain access token', err)); } | ||
} else { | ||
// NOTE: The module oauth (0.9.5), which is a dependency, automatically adds | ||
// a 'type=web_server' parameter to the query portion of the URL. | ||
// This appears to be an artifact from an earlier draft of OAuth 2.0 | ||
// (draft 22, as of the time of this writing). This parameter is not | ||
// necessary, but its presence does not appear to cause any issues. | ||
var params = this.authorizationParams(options); | ||
@@ -275,2 +267,18 @@ params.response_type = 'code'; | ||
/** | ||
* Return extra parameters to be included in the token request. | ||
* | ||
* Some OAuth 2.0 providers allow additional, non-standard parameters to be | ||
* included when requesting an access token. Since these parameters are not | ||
* standardized by the OAuth 2.0 specification, OAuth 2.0-based authentication | ||
* strategies can overrride this function in order to populate these parameters | ||
* as required by the provider. | ||
* | ||
* @return {Object} | ||
* @api protected | ||
*/ | ||
OAuth2Strategy.prototype.tokenParams = function(options) { | ||
return {}; | ||
}; | ||
/** | ||
* Parse error response from OAuth 2.0 endpoint. | ||
@@ -277,0 +285,0 @@ * |
{ | ||
"name": "passport-oauth2", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "OAuth 2.0 authentication strategy for Passport.", | ||
@@ -15,2 +15,7 @@ "keywords": [ | ||
], | ||
"author": { | ||
"name": "Jared Hanson", | ||
"email": "jaredhanson@gmail.com", | ||
"url": "http://www.jaredhanson.net/" | ||
}, | ||
"repository": { | ||
@@ -23,7 +28,2 @@ "type": "git", | ||
}, | ||
"author": { | ||
"name": "Jared Hanson", | ||
"email": "jaredhanson@gmail.com", | ||
"url": "http://www.jaredhanson.net/" | ||
}, | ||
"licenses": [ | ||
@@ -44,19 +44,10 @@ { | ||
"chai": "1.x.x", | ||
"chai-passport-strategy": "0.1.x" | ||
"chai-passport-strategy": "0.2.x" | ||
}, | ||
"engines": { "node": ">= 0.4.0" }, | ||
"engines": { | ||
"node": ">= 0.4.0" | ||
}, | ||
"scripts": { | ||
"test": "node_modules/.bin/mocha --reporter spec --require test/bootstrap/node test/*.test.js test/**/*.test.js" | ||
}, | ||
"testling": { | ||
"browsers": [ | ||
"chrome/latest" | ||
], | ||
"harness" : "mocha", | ||
"files": [ | ||
"test/bootstrap/testling.js", | ||
"test/*.test.js", | ||
"test/**/*.test.js" | ||
] | ||
} | ||
} |
# passport-oauth2 | ||
[![Build](https://travis-ci.org/jaredhanson/passport-oauth2.png)](http://travis-ci.org/jaredhanson/passport-oauth2) | ||
[![Build](https://travis-ci.org/jaredhanson/passport-oauth2.png)](https://travis-ci.org/jaredhanson/passport-oauth2) | ||
[![Coverage](https://coveralls.io/repos/jaredhanson/passport-oauth2/badge.png)](https://coveralls.io/r/jaredhanson/passport-oauth2) | ||
[![Dependencies](https://david-dm.org/jaredhanson/passport-oauth2.png)](http://david-dm.org/jaredhanson/passport-oauth2) | ||
[![Quality](https://codeclimate.com/github/jaredhanson/passport-oauth2.png)](https://codeclimate.com/github/jaredhanson/passport-oauth2) | ||
[![Dependencies](https://david-dm.org/jaredhanson/passport-oauth2.png)](https://david-dm.org/jaredhanson/passport-oauth2) | ||
[![Tips](http://img.shields.io/gittip/jaredhanson.png)](https://www.gittip.com/jaredhanson/) | ||
@@ -63,6 +65,6 @@ General-purpose OAuth 2.0 authentication strategy for [Passport](http://passportjs.org/). | ||
app.get('/auth/example', | ||
passport.authenticate('oauth')); | ||
passport.authenticate('oauth2')); | ||
app.get('/auth/example/callback', | ||
passport.authenticate('oauth', { failureRedirect: '/login' }), | ||
passport.authenticate('oauth2', { failureRedirect: '/login' }), | ||
function(req, res) { | ||
@@ -92,2 +94,2 @@ // Successful authentication, redirect home. | ||
Copyright (c) 2011-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> | ||
Copyright (c) 2011-2014 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> |
Sorry, the diff of this file is not supported yet
491
94
22674
9