Skip to content

Commit

Permalink
General improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaiklor committed Oct 2, 2015
1 parent 9b70b80 commit 6847714
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ node_js:
- '0.12'
- 'iojs'
- '4'
after_script: 'npm install coveralls && cat ./coverage/lcov.info | coveralls'
after_script:
- npm install coveralls && cat ./coverage/lcov.info | coveralls
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ The Google Plus authentication strategy authenticates users using a Google Plus
The strategy requires a `verify` callback, which accepts these credentials and calls `next` providing a user, as well as `options` specifying a app ID and app secret.

```javascript
var GooglePlusTokenStrategy = require('passport-google-plus-token');

passport.use(new GooglePlusTokenStrategy({
clientID: GOOGLE_CLIENT_ID,
clientSecret: GOOGLE_CLIENT_SECRET,
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "passport-google-plus-token",
"version": "2.0.0",
"version": "2.0.1",
"description": "Passport strategy for authenticating with Google Plus via OAuth2 access tokens",
"main": "lib/index.js",
"scripts": {
Expand Down Expand Up @@ -30,15 +30,15 @@
"url": "https://github.com/ghaiklor/passport-google-plus-token/issues"
},
"homepage": "https://github.com/ghaiklor/passport-google-plus-token",
"dependencies": {
"passport-oauth": "1.0.0"
},
"devDependencies": {
"babel": "5.8.23",
"chai": "2.3.0",
"chai-passport-strategy": "0.2.0",
"istanbul": "0.3.21",
"mocha": "2.3.3",
"sinon": "1.17.1"
},
"dependencies": {
"passport-oauth": "1.0.0"
}
}
24 changes: 11 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,18 @@ import { OAuth2Strategy, InternalOAuthError } from 'passport-oauth';
* - clientSecret Secret used to establish ownership of the consumer key
* - passReqToCallback If need, pass req to verify callback
*
* Example:
* passport.use(new GooglePlusTokenStrategy({
* clientID: '123-456-789',
* clientSecret: 'shhh-its-a-secret',
* passReqToCallback: true
* }, function(req, accessToken, refreshToken, profile, next) {
* User.findOrCreate(..., function (error, user) {
* next(error, user);
* });
* }
* ));
*
* @param {Object} _options
* @param {Function} _verify
* @constructor
* @example
* passport.use(new GooglePlusTokenStrategy({
* clientID: '123456789',
* clientSecret: 'shhh-its-a-secret'
* }), function(req, accessToken, refreshToken, profile, next) {
* User.findOrCreate({googleId: profile.id}, function(error, user) {
* next(error, user);
* });
* });
*/
export default class GooglePlusTokenStrategy extends OAuth2Strategy {
constructor(_options, _verify) {
Expand All @@ -43,7 +40,8 @@ export default class GooglePlusTokenStrategy extends OAuth2Strategy {
this._refreshTokenField = options.refreshTokenField || 'refresh_token';
this._profileURL = options.profileURL || 'https://www.googleapis.com/plus/v1/people/me';
this._passReqToCallback = options.passReqToCallback;
this._oauth2._useAuthorizationHeaderForGET = true;

this._oauth2.useAuthorizationHeaderforGET(true);
}

/**
Expand Down

0 comments on commit 6847714

Please sign in to comment.