From ae891a4222af6ff9d30cb6015ec4190cfdc65c41 Mon Sep 17 00:00:00 2001 From: Fred Chien Date: Sun, 24 Aug 2014 06:46:55 +0800 Subject: [PATCH 01/37] Get email address via github API v3 --- lib/strategy.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/strategy.js b/lib/strategy.js index 297b033..a9ec9ce 100644 --- a/lib/strategy.js +++ b/lib/strategy.js @@ -88,6 +88,8 @@ util.inherits(Strategy, OAuth2Strategy); * @api protected */ Strategy.prototype.userProfile = function(accessToken, done) { + var self = this; + this._oauth2.get(this._userProfileURL, accessToken, function (err, body, res) { var json; @@ -105,8 +107,24 @@ Strategy.prototype.userProfile = function(accessToken, done) { profile.provider = 'github'; profile._raw = body; profile._json = json; - - done(null, profile); + + // Getting emails + self._oauth2.get('https://api.github.com/user/emails', accessToken, function (err, body, res) { + + if (err) + return done(new InternalOAuthError('Failed to fetch user profile', err)); + + var json = JSON.parse(body); + + for (var index in json) { + if (json[index].primary) { + profile.emails = [{ value: json[index].email }]; + break; + } + } + + done(null, profile); + }); }); } From a0f7e43db96425df3233fa3d0b99eb9aa6e09335 Mon Sep 17 00:00:00 2001 From: Fred Chien Date: Thu, 28 Aug 2014 10:54:03 +0800 Subject: [PATCH 02/37] modified testcase for email API --- lib/strategy.js | 3 ++- test/strategy.options.test.js | 17 ++++++++++++----- test/strategy.profile.test.js | 14 ++++++++++---- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/lib/strategy.js b/lib/strategy.js index a9ec9ce..9cc3e87 100644 --- a/lib/strategy.js +++ b/lib/strategy.js @@ -62,6 +62,7 @@ function Strategy(options, verify) { OAuth2Strategy.call(this, options, verify); this.name = 'github'; this._userProfileURL = options.userProfileURL || 'https://api.github.com/user'; + this._userEmailURL = options.userEmailURL || 'https://api.github.com/user/emails'; this._oauth2.useAuthorizationHeaderforGET(true); } @@ -109,7 +110,7 @@ Strategy.prototype.userProfile = function(accessToken, done) { profile._json = json; // Getting emails - self._oauth2.get('https://api.github.com/user/emails', accessToken, function (err, body, res) { + self._oauth2.get(self._userEmailURL, accessToken, function (err, body, res) { if (err) return done(new InternalOAuthError('Failed to fetch user profile', err)); diff --git a/test/strategy.options.test.js b/test/strategy.options.test.js index dac9c10..d0f6481 100644 --- a/test/strategy.options.test.js +++ b/test/strategy.options.test.js @@ -10,16 +10,23 @@ describe('Strategy#userProfile', function() { var strategy = new GitHubStrategy({ clientID: 'ABC123', clientSecret: 'secret', - userProfileURL: 'https://github.corpDomain/api/v3/user' + userProfileURL: 'https://github.corpDomain/api/v3/user', + userEmailURL: 'https://github.corpDomain/api/v3/emails' }, function() {}); - + // mock strategy._oauth2.get = function(url, accessToken, callback) { - if (url != 'https://github.corpDomain/api/v3/user') { return callback(new Error('wrong url argument')); } + var testcases = { + 'https://github.corpDomain/api/v3/user': '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }', + 'https://github.corpDomain/api/v3/emails': '[ { "email": "octocat@github.com", "verified": true, "primary": true } ]' + }; + + var body = testcases[url] || null; + if (!body) + return callback(new Error('wrong url argument')); + if (accessToken != 'token') { return callback(new Error('wrong token argument')); } - - var body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }'; callback(null, body, undefined); }; diff --git a/test/strategy.profile.test.js b/test/strategy.profile.test.js index 3bd1c01..df3d4d4 100644 --- a/test/strategy.profile.test.js +++ b/test/strategy.profile.test.js @@ -14,10 +14,16 @@ describe('Strategy#userProfile', function() { // mock strategy._oauth2.get = function(url, accessToken, callback) { - if (url != 'https://api.github.com/user') { return callback(new Error('wrong url argument')); } - if (accessToken != 'token') { return callback(new Error('wrong token argument')); } - - var body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }'; + var testcases = { + 'https://api.github.com/user': '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }', + 'https://api.github.com/user/emails': '[ { "email": "octocat@github.com", "verified": true, "primary": true } ]' + }; + + var body = testcases[url] || null; + if (!body) + return callback(new Error('wrong url argument')); + + if (accessToken != 'token') { return callback(new Error('wrong token argument')); } callback(null, body, undefined); }; From 96abbc201741c0fd87773f00eb8333010f9b9f8e Mon Sep 17 00:00:00 2001 From: Fred Chien Date: Thu, 28 Aug 2014 19:33:41 +0800 Subject: [PATCH 03/37] * Disable node v0.4 on Travis CI * do not support node v0.4 anymore --- .travis.yml | 2 +- package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e0db184..f7d300a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ node_js: - "0.10" - "0.8" # - "0.6" - - "0.4" +# - "0.4" before_install: - "npm install istanbul -g" diff --git a/package.json b/package.json index c736df1..a4354ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "passport-github", - "version": "0.1.7", + "version": "0.1.8", "description": "GitHub authentication strategy for Passport.", "keywords": [ "passport", @@ -37,7 +37,7 @@ "chai": "1.x.x" }, "engines": { - "node": ">= 0.4.0" + "node": ">= 0.8.0" }, "scripts": { "test": "node_modules/.bin/mocha --reporter spec --require test/bootstrap/node test/*.test.js" From fb7a4159b9f21c9df692a4e4fec19d348b7fe637 Mon Sep 17 00:00:00 2001 From: Fred Chien Date: Fri, 12 Dec 2014 02:56:23 +0800 Subject: [PATCH 04/37] original author do not keep maintaining this module, so fork. --- package.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index a4354ba..31dc328 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "passport-github", + "name": "passport-github2", "version": "0.1.8", "description": "GitHub authentication strategy for Passport.", "keywords": [ @@ -15,12 +15,18 @@ "email": "jaredhanson@gmail.com", "url": "http://www.jaredhanson.net/" }, + "contributors": [ + { + "name": "Fred Chien", + "email": "cfsghost@gmail.com" + } + ], "repository": { "type": "git", - "url": "http://github.com/jaredhanson/passport-github.git" + "url": "http://github.com/cfsghost/passport-github.git" }, "bugs": { - "url": "http://github.com/jaredhanson/passport-github/issues" + "url": "http://github.com/cfsghost/passport-github/issues" }, "licenses": [ { From 07a5b101cca8d7d71a32a78caccd0910f71a7250 Mon Sep 17 00:00:00 2001 From: Fred Chien Date: Fri, 12 Dec 2014 03:09:12 +0800 Subject: [PATCH 05/37] Update Readme --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9e5c855..ead9a0d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# Passport-GitHub +# Passport-GitHub2 + +Author of Passport-Github do not maintain module for a long time, and features in this module doesn't work since Github upgrades their API to version 3.0, so that we fork its project and re-publish it to NPM with a new name `passport-Github2`. [Passport](http://passportjs.org/) strategy for authenticating with [GitHub](https://github.com/) using the OAuth 2.0 API. @@ -11,7 +13,7 @@ unobtrusively integrated into any application or framework that supports ## Install - $ npm install passport-github + $ npm install passport-github2 ## Usage @@ -54,18 +56,19 @@ application: ## Examples -For a complete, working example, refer to the [login example](https://github.com/jaredhanson/passport-github/tree/master/examples/login). +For a complete, working example, refer to the [login example](https://github.com/cfsghost/passport-github/tree/master/examples/login). ## Tests $ npm install --dev $ make test -[![Build Status](https://secure.travis-ci.org/jaredhanson/passport-github.png)](http://travis-ci.org/jaredhanson/passport-github) +[![Build Status](https://secure.travis-ci.org/cfsghost/passport-github.png)](http://travis-ci.org/cfsghost/passport-github) ## Credits - [Jared Hanson](http://github.com/jaredhanson) + - [Fred Chien](http://github.com/cfsghost) ## License From 91be6e9a2dacd2469ec0ea138aae6ef900092d4e Mon Sep 17 00:00:00 2001 From: Fred Chien Date: Fri, 12 Dec 2014 03:14:32 +0800 Subject: [PATCH 06/37] update example to use passport-github2 --- examples/login/app.js | 2 +- examples/login/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/login/app.js b/examples/login/app.js index 7d7e75e..d1c6f71 100644 --- a/examples/login/app.js +++ b/examples/login/app.js @@ -1,7 +1,7 @@ var express = require('express') , passport = require('passport') , util = require('util') - , GitHubStrategy = require('passport-github').Strategy; + , GitHubStrategy = require('passport-github2').Strategy; var GITHUB_CLIENT_ID = "--insert-github-client-id-here--" var GITHUB_CLIENT_SECRET = "--insert-github-client-secret-here--"; diff --git a/examples/login/package.json b/examples/login/package.json index 413b025..69534ed 100644 --- a/examples/login/package.json +++ b/examples/login/package.json @@ -5,6 +5,6 @@ "express": ">= 0.0.0", "ejs": ">= 0.0.0", "passport": ">= 0.0.0", - "passport-github": ">= 0.0.0" + "passport-github2": ">= 0.0.0" } } From 10d2ed58a6513fa8f27c3a230914cf578a4a831e Mon Sep 17 00:00:00 2001 From: Fred Chien Date: Fri, 12 Dec 2014 03:14:58 +0800 Subject: [PATCH 07/37] bump version to 0.1.9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 31dc328..12c685a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "passport-github2", - "version": "0.1.8", + "version": "0.1.9", "description": "GitHub authentication strategy for Passport.", "keywords": [ "passport", From c85f3a8193444d77349b6bb884a6d56ffb8b90c2 Mon Sep 17 00:00:00 2001 From: Fred Chien Date: Wed, 7 Jan 2015 13:10:01 +0800 Subject: [PATCH 08/37] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ead9a0d..bf28acf 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ For example, as route middleware in an [Express](http://expressjs.com/) application: app.get('/auth/github', - passport.authenticate('github')); + passport.authenticate('github', { scope: [ 'user:email' ] })); app.get('/auth/github/callback', passport.authenticate('github', { failureRedirect: '/login' }), From a08377eb89ea930b89db7a0da5300eaff44f9aaf Mon Sep 17 00:00:00 2001 From: Fred Chien Date: Wed, 7 Jan 2015 13:10:52 +0800 Subject: [PATCH 09/37] Update app.js --- examples/login/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/login/app.js b/examples/login/app.js index d1c6f71..4efaca4 100644 --- a/examples/login/app.js +++ b/examples/login/app.js @@ -86,7 +86,7 @@ app.get('/login', function(req, res){ // the user to github.com. After authorization, GitHubwill redirect the user // back to this application at /auth/github/callback app.get('/auth/github', - passport.authenticate('github'), + passport.authenticate('github', { scope: [ 'user:email' ] }), function(req, res){ // The request will be redirected to GitHub for authentication, so this // function will not be called. From 2aad1b6fd30347846273af1a264d55204b16aa88 Mon Sep 17 00:00:00 2001 From: Greg Turner Date: Fri, 27 Mar 2015 13:31:41 -0700 Subject: [PATCH 10/37] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bf28acf..e217f9f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Passport-GitHub2 -Author of Passport-Github do not maintain module for a long time, and features in this module doesn't work since Github upgrades their API to version 3.0, so that we fork its project and re-publish it to NPM with a new name `passport-Github2`. +The author of Passport-Github has not maintain module for a long time. Features in his module don't work since Github upgraded their API to version 3.0. We forked it and re-publish it to NPM with a new name `passport-github2`. [Passport](http://passportjs.org/) strategy for authenticating with [GitHub](https://github.com/) using the OAuth 2.0 API. From 14f87da5e3c9917e4303befc1a6b916e62de9a6e Mon Sep 17 00:00:00 2001 From: Colin Parsons Date: Tue, 9 Jun 2015 11:41:10 -0700 Subject: [PATCH 11/37] fix missing space in comment --- examples/login/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/login/app.js b/examples/login/app.js index 4efaca4..2dd1407 100644 --- a/examples/login/app.js +++ b/examples/login/app.js @@ -83,7 +83,7 @@ app.get('/login', function(req, res){ // GET /auth/github // Use passport.authenticate() as route middleware to authenticate the // request. The first step in GitHub authentication will involve redirecting -// the user to github.com. After authorization, GitHubwill redirect the user +// the user to github.com. After authorization, GitHub will redirect the user // back to this application at /auth/github/callback app.get('/auth/github', passport.authenticate('github', { scope: [ 'user:email' ] }), From a9953a884651bbaf6cbe3c073c817bb3d4b121ca Mon Sep 17 00:00:00 2001 From: Hack Reactor Students Date: Tue, 15 Sep 2015 11:55:36 -0700 Subject: [PATCH 12/37] update example to use express 4 --- examples/login/app.js | 43 +++++++++++++++++++------------------ examples/login/package.json | 9 ++++++-- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/examples/login/app.js b/examples/login/app.js index 2dd1407..a7dee87 100644 --- a/examples/login/app.js +++ b/examples/login/app.js @@ -1,9 +1,14 @@ -var express = require('express') - , passport = require('passport') - , util = require('util') - , GitHubStrategy = require('passport-github2').Strategy; +var express = require('express'); +var passport = require('passport'); +var util = require('util'); +var session = require('express-session'); +var bodyParser = require('body-parser'); +var methodOverride = require('method-override'); +var GitHubStrategy = require('passport-github2').Strategy; +var partials = require('express-partials'); -var GITHUB_CLIENT_ID = "--insert-github-client-id-here--" + +var GITHUB_CLIENT_ID = "--insert-github-client-id-here--"; var GITHUB_CLIENT_SECRET = "--insert-github-client-secret-here--"; @@ -48,24 +53,20 @@ passport.use(new GitHubStrategy({ -var app = express.createServer(); +var app = express(); // configure Express -app.configure(function() { - app.set('views', __dirname + '/views'); - app.set('view engine', 'ejs'); - app.use(express.logger()); - app.use(express.cookieParser()); - app.use(express.bodyParser()); - app.use(express.methodOverride()); - app.use(express.session({ secret: 'keyboard cat' })); - // Initialize Passport! Also use passport.session() middleware, to support - // persistent login sessions (recommended). - app.use(passport.initialize()); - app.use(passport.session()); - app.use(app.router); - app.use(express.static(__dirname + '/public')); -}); +app.set('views', __dirname + '/views'); +app.set('view engine', 'ejs'); +app.use(partials()); +app.use(bodyParser()); +app.use(methodOverride()); +app.use(session({ secret: 'keyboard cat' })); +// Initialize Passport! Also use passport.session() middleware, to support +// persistent login sessions (recommended). +app.use(passport.initialize()); +app.use(passport.session()); +app.use(express.static(__dirname + '/public')); app.get('/', function(req, res){ diff --git a/examples/login/package.json b/examples/login/package.json index 69534ed..ec3e8e9 100644 --- a/examples/login/package.json +++ b/examples/login/package.json @@ -2,9 +2,14 @@ "name": "passport-github-examples-login", "version": "0.0.0", "dependencies": { - "express": ">= 0.0.0", + "body-parser": "^1.13.3", "ejs": ">= 0.0.0", + "express": ">= 0.0.0", + "express-partials": "^0.3.0", + "express-session": "^1.11.3", + "method-override": "^2.3.5", "passport": ">= 0.0.0", - "passport-github2": ">= 0.0.0" + "passport-github2": ">= 0.0.0", + "router": "^1.1.3" } } From 0e801c21f7666578e6a415aa9a6c3a1fe41ff938 Mon Sep 17 00:00:00 2001 From: Doug Shamoo Date: Tue, 15 Sep 2015 21:01:22 -0700 Subject: [PATCH 13/37] Remove repeat word in app.js comment Remove repeat word 'function' in comment --- examples/login/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/login/app.js b/examples/login/app.js index 2dd1407..3c5db26 100644 --- a/examples/login/app.js +++ b/examples/login/app.js @@ -95,7 +95,7 @@ app.get('/auth/github', // GET /auth/github/callback // Use passport.authenticate() as route middleware to authenticate the // request. If authentication fails, the user will be redirected back to the -// login page. Otherwise, the primary route function function will be called, +// login page. Otherwise, the primary route function will be called, // which, in this example, will redirect the user to the home page. app.get('/auth/github/callback', passport.authenticate('github', { failureRedirect: '/login' }), From b54d0909dfac9bea2e4d86dd78a9e1a9178e56b8 Mon Sep 17 00:00:00 2001 From: Bastian Konetzny Date: Mon, 12 Oct 2015 16:46:11 +0200 Subject: [PATCH 14/37] Fixed error message for emails endpoint error. --- lib/strategy.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/strategy.js b/lib/strategy.js index 9cc3e87..b311731 100644 --- a/lib/strategy.js +++ b/lib/strategy.js @@ -6,7 +6,6 @@ var util = require('util') , Profile = require('./profile') , InternalOAuthError = require('passport-oauth2').InternalOAuthError; - /** * `Strategy` constructor. * @@ -22,7 +21,7 @@ var util = require('util') * - `clientID` your GitHub application's Client ID * - `clientSecret` your GitHub application's Client Secret * - `callbackURL` URL to which GitHub will redirect the user after granting authorization - * - `scope` array of permission scopes to request. valid scopes include: + * - `scope` array of permission scopes to request. Valid scopes include: * 'user', 'public_repo', 'repo', 'gist', or none. * (see http://developer.github.com/v3/oauth/#scopes for more info) * — `userAgent` All API requests MUST include a valid User Agent string. @@ -71,7 +70,6 @@ function Strategy(options, verify) { */ util.inherits(Strategy, OAuth2Strategy); - /** * Retrieve user profile from GitHub. * @@ -93,17 +91,17 @@ Strategy.prototype.userProfile = function(accessToken, done) { this._oauth2.get(this._userProfileURL, accessToken, function (err, body, res) { var json; - + if (err) { return done(new InternalOAuthError('Failed to fetch user profile', err)); } - + try { json = JSON.parse(body); } catch (ex) { return done(new Error('Failed to parse user profile')); } - + var profile = Profile.parse(json); profile.provider = 'github'; profile._raw = body; @@ -111,9 +109,9 @@ Strategy.prototype.userProfile = function(accessToken, done) { // Getting emails self._oauth2.get(self._userEmailURL, accessToken, function (err, body, res) { - - if (err) - return done(new InternalOAuthError('Failed to fetch user profile', err)); + if (err) { + return done(new InternalOAuthError('Failed to fetch user emails', err)); + } var json = JSON.parse(body); @@ -127,8 +125,7 @@ Strategy.prototype.userProfile = function(accessToken, done) { done(null, profile); }); }); -} - +}; /** * Expose `Strategy`. From 3ed2d4858516015fbbb954e0bcf260cb6299f31f Mon Sep 17 00:00:00 2001 From: Casandra Silva Date: Sat, 21 Nov 2015 21:58:18 -0800 Subject: [PATCH 15/37] README edit Grammar fixes in intro blurb --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e217f9f..98a6042 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Passport-GitHub2 -The author of Passport-Github has not maintain module for a long time. Features in his module don't work since Github upgraded their API to version 3.0. We forked it and re-publish it to NPM with a new name `passport-github2`. +The author of Passport-Github has not maintained the original module for a long time. Features in his module don't work since Github upgraded their API to version 3.0. We forked it and re-published it to NPM with a new name `passport-github2`. [Passport](http://passportjs.org/) strategy for authenticating with [GitHub](https://github.com/) using the OAuth 2.0 API. From 2e93928d9a1e50a6d9731785f5fc86cc7c8909f3 Mon Sep 17 00:00:00 2001 From: Gerhard Preuss Date: Mon, 4 Jan 2016 09:05:00 +0100 Subject: [PATCH 16/37] fix deprecated express middleware warnings --- examples/login/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/login/app.js b/examples/login/app.js index f929133..5c7e9fc 100644 --- a/examples/login/app.js +++ b/examples/login/app.js @@ -59,9 +59,10 @@ var app = express(); app.set('views', __dirname + '/views'); app.set('view engine', 'ejs'); app.use(partials()); -app.use(bodyParser()); +app.use(bodyParser.urlencoded({ extended: true })); +app.use(bodyParser.json()); app.use(methodOverride()); -app.use(session({ secret: 'keyboard cat' })); +app.use(session({ secret: 'keyboard cat', resave: false, saveUninitialized: false })); // Initialize Passport! Also use passport.session() middleware, to support // persistent login sessions (recommended). app.use(passport.initialize()); From 1ca2a122dc4aa922059331bfad10fa1f6d8c5840 Mon Sep 17 00:00:00 2001 From: Mikael Korpela Date: Mon, 4 Jan 2016 00:14:17 -0800 Subject: [PATCH 17/37] Update Travis NodeJS versions --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index f7d300a..129c575 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ language: "node_js" node_js: - - "0.10" - - "0.8" -# - "0.6" -# - "0.4" + - "5" + - "4" + - "0.12" before_install: - "npm install istanbul -g" From 5d667732765ba765f5a7c8706be387989f8295ad Mon Sep 17 00:00:00 2001 From: isayme Date: Wed, 20 Jan 2016 14:53:32 +0800 Subject: [PATCH 18/37] request _userEmailURL when has user:email permission --- lib/strategy.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/strategy.js b/lib/strategy.js index b311731..aa9a5be 100644 --- a/lib/strategy.js +++ b/lib/strategy.js @@ -32,7 +32,7 @@ var util = require('util') * * passport.use(new GitHubStrategy({ * clientID: '123-456-789', - * clientSecret: 'shhh-its-a-secret' + * clientSecret: 'shhh-its-a-secret', * callbackURL: 'https://www.example.net/auth/github/callback', * userAgent: 'myapp.com' * }, @@ -107,6 +107,20 @@ Strategy.prototype.userProfile = function(accessToken, done) { profile._raw = body; profile._json = json; + var canAccessEmail = false; + var scopes = self._scope; + if (typeof scopes === 'string') { + scopes = scopes.split(self._scopeSeparator); + } + if (Array.isArray(scopes)) { + canAccessEmail = scopes.some(function(scope) { + return scope === 'user' || scope === 'user:email'; + }); + } + if (!canAccessEmail) { + return done(null, profile); + } + // Getting emails self._oauth2.get(self._userEmailURL, accessToken, function (err, body, res) { if (err) { From d572f18d0031c2bb891bf7a966eb4d5d4211381b Mon Sep 17 00:00:00 2001 From: Fred Chien Date: Tue, 1 Mar 2016 10:51:42 +0800 Subject: [PATCH 19/37] bump version to 0.1.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 12c685a..a781622 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "passport-github2", - "version": "0.1.9", + "version": "0.1.10", "description": "GitHub authentication strategy for Passport.", "keywords": [ "passport", From a456666920dcc2d5c11428209d33af771651ceca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fred=20Chien=28=E9=8C=A2=E9=80=A2=E7=A5=A5=29?= Date: Tue, 22 Aug 2017 16:43:11 +0800 Subject: [PATCH 20/37] Update README.md --- README.md | 54 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 98a6042..33cf455 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,11 @@ unobtrusively integrated into any application or framework that supports [Connect](http://www.senchalabs.org/connect/)-style middleware, including [Express](http://expressjs.com/). -## Install +## Installation - $ npm install passport-github2 +```shell +$ npm install passport-github2 +``` ## Usage @@ -24,17 +26,19 @@ and OAuth 2.0 tokens. The strategy requires a `verify` callback, which accepts these credentials and calls `done` providing a user, as well as `options` specifying a client ID, client secret, and callback URL. - passport.use(new GitHubStrategy({ - clientID: GITHUB_CLIENT_ID, - clientSecret: GITHUB_CLIENT_SECRET, - callbackURL: "http://127.0.0.1:3000/auth/github/callback" - }, - function(accessToken, refreshToken, profile, done) { - User.findOrCreate({ githubId: profile.id }, function (err, user) { - return done(err, user); - }); - } - )); +```javascript +passport.use(new GitHubStrategy({ + clientID: GITHUB_CLIENT_ID, + clientSecret: GITHUB_CLIENT_SECRET, + callbackURL: "http://127.0.0.1:3000/auth/github/callback" + }, + function(accessToken, refreshToken, profile, done) { + User.findOrCreate({ githubId: profile.id }, function (err, user) { + return done(err, user); + }); + } +)); +``` #### Authenticate Requests @@ -44,15 +48,17 @@ authenticate requests. For example, as route middleware in an [Express](http://expressjs.com/) application: - app.get('/auth/github', - passport.authenticate('github', { scope: [ 'user:email' ] })); +```javascript +app.get('/auth/github', + passport.authenticate('github', { scope: [ 'user:email' ] })); - app.get('/auth/github/callback', - passport.authenticate('github', { failureRedirect: '/login' }), - function(req, res) { - // Successful authentication, redirect home. - res.redirect('/'); - }); +app.get('/auth/github/callback', + passport.authenticate('github', { failureRedirect: '/login' }), + function(req, res) { + // Successful authentication, redirect home. + res.redirect('/'); + }); +``` ## Examples @@ -60,8 +66,10 @@ For a complete, working example, refer to the [login example](https://github.com ## Tests - $ npm install --dev - $ make test +```shell +$ npm install --dev +$ make test +``` [![Build Status](https://secure.travis-ci.org/cfsghost/passport-github.png)](http://travis-ci.org/cfsghost/passport-github) From b274eb42f2e8979b34213aa54e11c5114e136eea Mon Sep 17 00:00:00 2001 From: Per-Kristian Nordnes Date: Wed, 30 Aug 2017 10:58:56 +0200 Subject: [PATCH 21/37] Add avatar_url from Github to Passport's profile.photos --- lib/profile.js | 4 +++- test/strategy.profile.test.js | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/profile.js b/lib/profile.js index e3a4acb..f14e30d 100644 --- a/lib/profile.js +++ b/lib/profile.js @@ -18,6 +18,8 @@ exports.parse = function(json) { if (json.email) { profile.emails = [{ value: json.email }]; } - + if (json.avatar_url) { + profile.photos = [{ value: json.avatar_url }]; + } return profile; }; diff --git a/test/strategy.profile.test.js b/test/strategy.profile.test.js index df3d4d4..34c1c9a 100644 --- a/test/strategy.profile.test.js +++ b/test/strategy.profile.test.js @@ -15,8 +15,8 @@ describe('Strategy#userProfile', function() { // mock strategy._oauth2.get = function(url, accessToken, callback) { var testcases = { - 'https://api.github.com/user': '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }', - 'https://api.github.com/user/emails': '[ { "email": "octocat@github.com", "verified": true, "primary": true } ]' + 'https://api.github.com/user': '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "avatar_url": "https://avatars1.githubusercontent.com/u/583231?v=3&s=460", "html_url": "https://github.com/octocat" }', + 'https://api.github.com/user/emails': '[ { "email": "octocat@github.com", "verified": true, "primary": true } ]' }; var body = testcases[url] || null; @@ -48,6 +48,8 @@ describe('Strategy#userProfile', function() { expect(profile.profileUrl).to.equal('https://github.com/octocat'); expect(profile.emails).to.have.length(1); expect(profile.emails[0].value).to.equal('octocat@github.com'); + expect(profile.photos).to.have.length(1); + expect(profile.photos[0].value).to.equal('https://avatars1.githubusercontent.com/u/583231?v=3&s=460'); }); it('should set raw property', function() { From e36a2791e92fdca344592b0af9af665c7546cc22 Mon Sep 17 00:00:00 2001 From: Fred Chien Date: Wed, 27 Sep 2017 12:41:29 +0800 Subject: [PATCH 22/37] 0.1.11 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a781622..07782a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "passport-github2", - "version": "0.1.10", + "version": "0.1.11", "description": "GitHub authentication strategy for Passport.", "keywords": [ "passport", @@ -18,7 +18,7 @@ "contributors": [ { "name": "Fred Chien", - "email": "cfsghost@gmail.com" + "email": "cfsghost@gmail.com" } ], "repository": { From 93e2777e58ab6a04608aa34dea4121409515ec26 Mon Sep 17 00:00:00 2001 From: guoshencheng <648772021@qq.com> Date: Sat, 30 Sep 2017 16:05:02 +0800 Subject: [PATCH 23/37] add option for name --- lib/strategy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/strategy.js b/lib/strategy.js index aa9a5be..e28370e 100644 --- a/lib/strategy.js +++ b/lib/strategy.js @@ -59,7 +59,7 @@ function Strategy(options, verify) { } OAuth2Strategy.call(this, options, verify); - this.name = 'github'; + this.name = options.name || 'github'; this._userProfileURL = options.userProfileURL || 'https://api.github.com/user'; this._userEmailURL = options.userEmailURL || 'https://api.github.com/user/emails'; this._oauth2.useAuthorizationHeaderforGET(true); From 3fa562ebdc47ccb1f136e774a1c2453dce76af0b Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 10:09:07 -0800 Subject: [PATCH 24/37] Update package.json with contributor, fork URL --- package.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 552fa38..7ae9263 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "passport-github", - "version": "1.1.0", + "version": "https://github.com/benjspriggs/passport-github/tarball/master", "description": "GitHub authentication strategy for Passport.", "keywords": [ "passport", @@ -19,14 +19,18 @@ { "name": "Fred Chien", "email": "cfsghost@gmail.com" + }, + { + "name": "Benajmin Spriggs", + "email": "ben@sprico.com" } ], "repository": { "type": "git", - "url": "http://github.com/cfsghost/passport-github.git" + "url": "http://github.com/jaredhanson/passport-github" }, "bugs": { - "url": "http://github.com/cfsghost/passport-github/issues" + "url": "http://github.com/jaredhanson/passport-github/issue" }, "license": "MIT", "licenses": [ @@ -52,4 +56,4 @@ "scripts": { "test": "node_modules/.bin/mocha --require test/bootstrap/node test/*.test.js" } -} + } From fe27b3da14bbae87de8aeeab614c889ccc161533 Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 10:19:58 -0800 Subject: [PATCH 25/37] Update package for new minor --- package-lock.json | 2 +- package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 10df350..cb3bb6a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "passport-github", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7ae9263..672061b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "passport-github", - "version": "https://github.com/benjspriggs/passport-github/tarball/master", + "version": "1.1.1", "description": "GitHub authentication strategy for Passport.", "keywords": [ "passport", @@ -56,4 +56,4 @@ "scripts": { "test": "node_modules/.bin/mocha --require test/bootstrap/node test/*.test.js" } - } +} From 9a67da65604870a6382bb56a232a3e894b73ee84 Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 11:13:11 -0800 Subject: [PATCH 26/37] Update test to refer to avatar URL and assrt that photo is pulled into profile, rather than from GraphQL --- test/strategy.profile.test.js | 321 +++++++++++++++++----------------- 1 file changed, 160 insertions(+), 161 deletions(-) diff --git a/test/strategy.profile.test.js b/test/strategy.profile.test.js index 47ab7f6..c091faa 100644 --- a/test/strategy.profile.test.js +++ b/test/strategy.profile.test.js @@ -5,15 +5,15 @@ var GitHubStrategy = require('../lib/strategy'); describe('Strategy#userProfile', function() { - + describe('fetched from default endpoint', function() { var strategy = new GitHubStrategy({ clientID: 'ABC123', clientSecret: 'secret' }, function() {}); - - // mock - strategy._oauth2.get = function(url, accessToken, callback) { + + // mock + strategy._oauth2.get = function(url, accessToken, callback) { var testcases = { 'https://api.github.com/user': '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "avatar_url": "https://avatars1.githubusercontent.com/u/583231?v=3&s=460", "html_url": "https://github.com/octocat" }', 'https://api.github.com/user/emails': '[ { "email": "octocat@github.com", "verified": true, "primary": true } ]' @@ -24,71 +24,71 @@ describe('Strategy#userProfile', function() { return callback(new Error('wrong url argument')); if (accessToken != 'token') { return callback(new Error('wrong token argument')); } -======= - strategy._oauth2.get = function(url, accessToken, callback) { - if (url != 'https://api.github.com/user') { return callback(new Error('wrong url argument')); } - if (accessToken != 'token') { return callback(new Error('wrong token argument')); } - - var body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }'; - callback(null, body, undefined); - }; - - - var profile; - - before(function(done) { - strategy.userProfile('token', function(err, p) { - if (err) { return done(err); } - profile = p; - done(); + strategy._oauth2.get = function(url, accessToken, callback) { + if (url != 'https://api.github.com/user') { return callback(new Error('wrong url argument')); } + if (accessToken != 'token') { return callback(new Error('wrong token argument')); } + + var body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }'; + callback(null, body, undefined); + }; + + + var profile; + + before(function(done) { + strategy.userProfile('token', function(err, p) { + if (err) { return done(err); } + profile = p; + done(); + }); }); - }); - - it('should parse profile', function() { - expect(profile.provider).to.equal('github'); - - expect(profile.id).to.equal('1'); - expect(profile.username).to.equal('octocat'); - expect(profile.displayName).to.equal('monalisa octocat'); - expect(profile.profileUrl).to.equal('https://github.com/octocat'); - expect(profile.emails).to.have.length(1); - expect(profile.emails[0].value).to.equal('octocat@github.com'); - }); - - it('should set raw property', function() { - expect(profile._raw).to.be.a('string'); - }); - - it('should set json property', function() { - expect(profile._json).to.be.an('object'); - }); + + it('should parse profile', function() { + expect(profile.provider).to.equal('github'); + + expect(profile.id).to.equal('1'); + expect(profile.username).to.equal('octocat'); + expect(profile.displayName).to.equal('monalisa octocat'); + expect(profile.profileUrl).to.equal('https://github.com/octocat'); + expect(profile.emails).to.have.length(1); + expect(profile.emails[0].value).to.equal('octocat@github.com'); + }); + + it('should set raw property', function() { + expect(profile._raw).to.be.a('string'); + }); + + it('should set json property', function() { + expect(profile._json).to.be.an('object'); + }); + }; }); // fetched from default endpoint - + describe('fetched from default endpoint and then fetching emails, where user has a publicly visible email address', function() { var strategy = new GitHubStrategy({ clientID: 'ABC123', clientSecret: 'secret', scope: [ 'user:email' ] }, function() {}); - + strategy._oauth2._request = function(method, url, headers, body, accessToken, callback) { var body; switch (url) { - case 'https://api.github.com/user': - body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }'; - break; - case 'https://api.github.com/user/emails': - body = '[{"email":"octocat@github.com","primary":true,"verified":true}]'; - break; - default: - return callback(new Error('wrong url argument')); + case 'https://api.github.com/user': + body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }'; + break; + case 'https://api.github.com/user/emails': + body = '[{"email":"octocat@github.com","primary":true,"verified":true}]'; + break; + default: + return callback(new Error('wrong url argument')); } callback(null, body, undefined); }; - - + + var profile; - + before(function(done) { strategy.userProfile('token', function(err, p) { if (err) { return done(err); } @@ -96,10 +96,10 @@ describe('Strategy#userProfile', function() { done(); }); }); - + it('should parse profile', function() { expect(profile.provider).to.equal('github'); - + expect(profile.id).to.equal('1'); expect(profile.username).to.equal('octocat'); expect(profile.displayName).to.equal('monalisa octocat'); @@ -109,42 +109,41 @@ describe('Strategy#userProfile', function() { expect(profile.emails[0].primary).to.equal(true); expect(profile.emails[0].verified).to.equal(true); }); - + it('should set raw property', function() { expect(profile._raw).to.be.a('string'); }); - + it('should set json property', function() { expect(profile._json).to.be.an('object'); }); }); // fetched from default endpoint and then fetching emails, where user has a publicly visible email address - + describe('fetched from default endpoint and then fetching emails, where user does not have a publicly visible email address', function() { var strategy = new GitHubStrategy({ clientID: 'ABC123', clientSecret: 'secret', scope: [ 'user:email' ] }, function() {}); ->>>>>>> 4db6a1b1a1c8e416b830afb1a0b852020d234a90 - + strategy._oauth2._request = function(method, url, headers, body, accessToken, callback) { var body; switch (url) { - case 'https://api.github.com/user': - body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "html_url": "https://github.com/octocat" }'; - break; - case 'https://api.github.com/user/emails': - body = '[{"email":"octocat@github.com","primary":true,"verified":true}]'; - break; - default: - return callback(new Error('wrong url argument')); + case 'https://api.github.com/user': + body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "html_url": "https://github.com/octocat" }'; + break; + case 'https://api.github.com/user/emails': + body = '[{"email":"octocat@github.com","primary":true,"verified":true}]'; + break; + default: + return callback(new Error('wrong url argument')); } callback(null, body, undefined); }; - - + + var profile; - + before(function(done) { strategy.userProfile('token', function(err, p) { if (err) { return done(err); } @@ -152,10 +151,10 @@ describe('Strategy#userProfile', function() { done(); }); }); - + it('should parse profile', function() { expect(profile.provider).to.equal('github'); - + expect(profile.id).to.equal('1'); expect(profile.username).to.equal('octocat'); expect(profile.displayName).to.equal('monalisa octocat'); @@ -165,41 +164,41 @@ describe('Strategy#userProfile', function() { expect(profile.emails[0].primary).to.equal(true); expect(profile.emails[0].verified).to.equal(true); }); - + it('should set raw property', function() { expect(profile._raw).to.be.a('string'); }); - + it('should set json property', function() { expect(profile._json).to.be.an('object'); }); }); // fetched from default endpoint and then fetching emails, where user does not have a publicly visible email address - + describe('fetched from default endpoint and then fetching emails, where user does not have any publicly visible or privately available email addresses', function() { var strategy = new GitHubStrategy({ clientID: 'ABC123', clientSecret: 'secret', scope: [ 'user:email' ] }, function() {}); - + strategy._oauth2._request = function(method, url, headers, body, accessToken, callback) { var body; switch (url) { - case 'https://api.github.com/user': - body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "html_url": "https://github.com/octocat" }'; - break; - case 'https://api.github.com/user/emails': - body = '[]'; - break; - default: - return callback(new Error('wrong url argument')); + case 'https://api.github.com/user': + body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "html_url": "https://github.com/octocat" }'; + break; + case 'https://api.github.com/user/emails': + body = '[]'; + break; + default: + return callback(new Error('wrong url argument')); } callback(null, body, undefined); }; - - + + var profile; - + before(function(done) { strategy.userProfile('token', function(err, p) { if (err) { return done(err); } @@ -207,51 +206,51 @@ describe('Strategy#userProfile', function() { done(); }); }); - + it('should parse profile', function() { expect(profile.provider).to.equal('github'); - + expect(profile.id).to.equal('1'); expect(profile.username).to.equal('octocat'); expect(profile.displayName).to.equal('monalisa octocat'); expect(profile.profileUrl).to.equal('https://github.com/octocat'); expect(profile.emails).to.be.undefined; }); - + it('should set raw property', function() { expect(profile._raw).to.be.a('string'); }); - + it('should set json property', function() { expect(profile._json).to.be.an('object'); }); }); // fetched from default endpoint and then fetching emails, where user does not have any publicly visible or privately available email addresses - + describe('fetched from default endpoint and then fetching emails, where user has a publicly visible email address but user:email scope has not been granted', function() { var strategy = new GitHubStrategy({ clientID: 'ABC123', clientSecret: 'secret', scope: [ 'user:email' ] }, function() {}); - + strategy._oauth2._request = function(method, url, headers, body, accessToken, callback) { var body; switch (url) { - case 'https://api.github.com/user': - body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }'; - break; - case 'https://api.github.com/user/emails': - return callback({ statusCode: 404, - data: '{"message":"Not Found","documentation_url":"https://developer.github.com/v3"}' }); - default: - return callback(new Error('wrong url argument')); + case 'https://api.github.com/user': + body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }'; + break; + case 'https://api.github.com/user/emails': + return callback({ statusCode: 404, + data: '{"message":"Not Found","documentation_url":"https://developer.github.com/v3"}' }); + default: + return callback(new Error('wrong url argument')); } callback(null, body, undefined); }; - - + + var profile; - + before(function(done) { strategy.userProfile('token', function(err, p) { if (err) { return done(err); } @@ -259,10 +258,10 @@ describe('Strategy#userProfile', function() { done(); }); }); - + it('should parse profile', function() { expect(profile.provider).to.equal('github'); - + expect(profile.id).to.equal('1'); expect(profile.username).to.equal('octocat'); expect(profile.displayName).to.equal('monalisa octocat'); @@ -272,41 +271,41 @@ describe('Strategy#userProfile', function() { expect(profile.emails[0].primary).to.equal(undefined); expect(profile.emails[0].verified).to.equal(undefined); }); - + it('should set raw property', function() { expect(profile._raw).to.be.a('string'); }); - + it('should set json property', function() { expect(profile._json).to.be.an('object'); }); }); // fetched from default endpoint and then fetching emails, where user has a publicly visible email address but user:email scope has not been granted - + describe('fetched from default endpoint and then fetching emails, where user has a publicly visible email address but emails response is malformed', function() { var strategy = new GitHubStrategy({ clientID: 'ABC123', clientSecret: 'secret', scope: [ 'user:email' ] }, function() {}); - + strategy._oauth2._request = function(method, url, headers, body, accessToken, callback) { var body; switch (url) { - case 'https://api.github.com/user': - body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }'; - break; - case 'https://api.github.com/user/emails': - body = 'Hello, world.'; - break; - default: - return callback(new Error('wrong url argument')); + case 'https://api.github.com/user': + body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }'; + break; + case 'https://api.github.com/user/emails': + body = 'Hello, world.'; + break; + default: + return callback(new Error('wrong url argument')); } callback(null, body, undefined); }; - - + + var profile; - + before(function(done) { strategy.userProfile('token', function(err, p) { if (err) { return done(err); } @@ -314,10 +313,10 @@ describe('Strategy#userProfile', function() { done(); }); }); - + it('should parse profile', function() { expect(profile.provider).to.equal('github'); - + expect(profile.id).to.equal('1'); expect(profile.username).to.equal('octocat'); expect(profile.displayName).to.equal('monalisa octocat'); @@ -327,34 +326,34 @@ describe('Strategy#userProfile', function() { expect(profile.emails[0].primary).to.equal(undefined); expect(profile.emails[0].verified).to.equal(undefined); }); - + it('should set raw property', function() { expect(profile._raw).to.be.a('string'); }); - + it('should set json property', function() { expect(profile._json).to.be.an('object'); }); }); // fetched from default endpoint and then fetching emails, where user has a publicly visible email address but emails response is malformed - + describe('fetched from custom endpoint', function() { var strategy = new GitHubStrategy({ clientID: 'ABC123', clientSecret: 'secret', userProfileURL: 'https://github.corpDomain/api/v3/user' }, function() {}); - + strategy._oauth2.get = function(url, accessToken, callback) { if (url != 'https://github.corpDomain/api/v3/user') { return callback(new Error('wrong url argument')); } if (accessToken != 'token') { return callback(new Error('wrong token argument')); } - - var body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat" }'; + + var body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@github.com", "html_url": "https://github.com/octocat", "avatar_url": "https://github.com/images/error/octocat_happy.gif" }'; callback(null, body, undefined); }; - - + + var profile; - + before(function(done) { strategy.userProfile('token', function(err, p) { if (err) { return done(err); } @@ -362,10 +361,10 @@ describe('Strategy#userProfile', function() { done(); }); }); - + it('should parse profile', function() { expect(profile.provider).to.equal('github'); - + expect(profile.id).to.equal('1'); expect(profile.username).to.equal('octocat'); expect(profile.displayName).to.equal('monalisa octocat'); @@ -373,29 +372,29 @@ describe('Strategy#userProfile', function() { expect(profile.emails).to.have.length(1); expect(profile.emails[0].value).to.equal('octocat@github.com'); expect(profile.photos).to.have.length(1); - expect(profile.photos[0].value).to.equal('https://avatars1.githubusercontent.com/u/583231?v=3&s=460'); + expect(profile.photos[0].value).to.equal('https://github.com/images/error/octocat_happy.gif'); }); - + it('should set raw property', function() { expect(profile._raw).to.be.a('string'); }); - + it('should set json property', function() { expect(profile._json).to.be.an('object'); }); }); - + describe('error caused by invalid token', function() { var strategy = new GitHubStrategy({ - clientID: 'ABC123', - clientSecret: 'secret' - }, function() {}); - + clientID: 'ABC123', + clientSecret: 'secret' + }, function() {}); + strategy._oauth2.get = function(url, accessToken, callback) { var body = '{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}'; callback({ statusCode: 400, data: body }); }; - + var err, profile; before(function(done) { strategy.userProfile('token', function(e, p) { @@ -404,25 +403,25 @@ describe('Strategy#userProfile', function() { done(); }); }); - + it('should error', function() { expect(err).to.be.an.instanceOf(Error); expect(err.constructor.name).to.equal('APIError'); expect(err.message).to.equal('Bad credentials'); }); }); // error caused by invalid token - + describe('error caused by malformed response', function() { var strategy = new GitHubStrategy({ - clientID: 'ABC123', - clientSecret: 'secret' - }, function() {}); - + clientID: 'ABC123', + clientSecret: 'secret' + }, function() {}); + strategy._oauth2.get = function(url, accessToken, callback) { var body = 'Hello, world.'; callback(null, body, undefined); }; - + var err, profile; before(function(done) { strategy.userProfile('token', function(e, p) { @@ -431,26 +430,26 @@ describe('Strategy#userProfile', function() { done(); }); }); - + it('should error', function() { expect(err).to.be.an.instanceOf(Error); expect(err.message).to.equal('Failed to parse user profile'); }); }); // error caused by malformed response - + describe('internal error', function() { var strategy = new GitHubStrategy({ clientID: 'ABC123', clientSecret: 'secret' }, function() {}); - + strategy._oauth2.get = function(url, accessToken, callback) { return callback(new Error('something went wrong')); } - - + + var err, profile; - + before(function(done) { strategy.userProfile('wrong-token', function(e, p) { err = e; @@ -458,7 +457,7 @@ describe('Strategy#userProfile', function() { done(); }); }); - + it('should error', function() { expect(err).to.be.an.instanceOf(Error); expect(err.constructor.name).to.equal('InternalOAuthError'); @@ -466,10 +465,10 @@ describe('Strategy#userProfile', function() { expect(err.oauthError).to.be.an.instanceOf(Error); expect(err.oauthError.message).to.equal('something went wrong'); }); - + it('should not load profile', function() { expect(profile).to.be.undefined; }); }); // internal error - + }); From ee9b9ea70e5063eed3b5070e107aae68747a5570 Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 11:13:22 -0800 Subject: [PATCH 27/37] Update outdated dependencies --- package-lock.json | 303 +++++++++++++++++++++++++++++++--------------- package.json | 6 +- 2 files changed, 209 insertions(+), 100 deletions(-) diff --git a/package-lock.json b/package-lock.json index cb3bb6a..57a15bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,19 +5,45 @@ "requires": true, "dependencies": { "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "balanced-match": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.0.tgz", - "integrity": "sha1-x/hUOP3UZrx8oWq5DIFRN5el0js=", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", "dev": true }, "chai": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-2.3.0.tgz", - "integrity": "sha1-ii9qNHSNqAEJD9cyh7Kqc5pOkJo=", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", + "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", "dev": true, "requires": { - "assertion-error": "1.0.0", - "deep-eql": "0.1.3" + "assertion-error": "1.1.0", + "check-error": "1.0.2", + "deep-eql": "3.0.1", + "get-func-name": "2.0.0", + "pathval": "1.1.0", + "type-detect": "4.0.7" } }, "chai-passport-strategy": { @@ -26,99 +52,128 @@ "integrity": "sha1-2rGASPbqeG7JjLlNS3nAxi/z8gQ=", "dev": true }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, "commander": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.3.0.tgz", - "integrity": "sha1-/UMOiJgy7DU7ms0d4hfBHLPu+HM=", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, "debug": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.0.0.tgz", - "integrity": "sha1-ib2d9nMrUSVrxnBTQrugLtEhMe8=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { - "ms": "0.6.2" + "ms": "2.0.0" } }, "deep-eql": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", - "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "dev": true, "requires": { - "type-detect": "0.1.1" + "type-detect": "4.0.7" } }, "diff": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/diff/-/diff-1.0.8.tgz", - "integrity": "sha1-NDJ2MI7Jkbe8giZ+1VvBQR+XFmY=", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", "dev": true }, "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "fill-keys": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz", - "integrity": "sha1-Tbwv5nTnGUnK8/smlc5/LcHZqNE=", + "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", + "integrity": "sha1-mo+jb06K1jTjv2tPPIiCVRRS6yA=", + "dev": true, + "requires": { + "is-object": "1.0.1", + "merge-descriptors": "1.0.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, "glob": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.3.tgz", - "integrity": "sha1-4xPusknHr/qlxHUoaw4RW1mDlGc=", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "graceful-fs": "2.0.3", + "fs.realpath": "1.0.0", + "inflight": "1.0.6", "inherits": "2.0.3", - "minimatch": "0.2.14" + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, - "graceful-fs": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-2.0.3.tgz", - "integrity": "sha1-fNLNsiiko/Nule+mzBQt59GhNtA=", + "growl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", + "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", "dev": true }, - "growl": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.8.1.tgz", - "integrity": "sha1-Sy3sjZB+k9szZiTc7AGDUC+MlCg=", + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", "dev": true }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", "dev": true }, - "jade": { - "version": "0.26.3", - "resolved": "https://registry.npmjs.org/jade/-/jade-0.26.3.tgz", - "integrity": "sha1-jxDXl32NefL2/4YqgbBRPMslaGw=", + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "commander": "0.6.1", - "mkdirp": "0.3.0" - }, - "dependencies": { - "commander": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz", - "integrity": "sha1-+mihT2qUXVTbvlDYzbMyDp47GgY=", - "dev": true - }, - "mkdirp": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz", - "integrity": "sha1-G79asbqCevI1dRQ0kEJkVfSB/h4=", - "dev": true - } + "once": "1.4.0", + "wrappy": "1.0.2" } }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "is-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", + "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", "dev": true }, "make-node": { @@ -127,14 +182,19 @@ "integrity": "sha1-LTVN240+zfWg1btMrbuqRGHK3jo=", "dev": true }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", + "dev": true + }, "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "lru-cache": "2.7.3", - "sigmund": "1.0.1" + "brace-expansion": "1.1.8" } }, "minimist": { @@ -144,34 +204,42 @@ "dev": true }, "mkdirp": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz", - "integrity": "sha1-HXMHam35hs2TROFecfzAWkyavxI=", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { "minimist": "0.0.8" } }, "mocha": { - "version": "1.21.5", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-1.21.5.tgz", - "integrity": "sha1-fFiwkXTfl25DSiOx6NY5hz/FKek=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.0.0.tgz", + "integrity": "sha512-ukB2dF+u4aeJjc6IGtPNnJXfeby5d4ZqySlIBT0OEyva/DrMjVm5HkQxKnHDLKEfEQBsEnwTg9HHhtPHJdTd8w==", "dev": true, "requires": { - "commander": "2.3.0", - "debug": "2.0.0", - "diff": "1.0.8", - "escape-string-regexp": "1.0.2", - "glob": "3.2.3", - "growl": "1.8.1", - "jade": "0.26.3", - "mkdirp": "0.5.0" + "browser-stdout": "1.3.0", + "commander": "2.11.0", + "debug": "3.1.0", + "diff": "3.3.1", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.3", + "he": "1.1.1", + "mkdirp": "0.5.1", + "supports-color": "4.4.0" } }, + "module-not-found-error": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz", + "integrity": "sha1-z4tP9PKWQGdNbN0CsOO8UjwrvcA=", + "dev": true + }, "ms": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.6.2.tgz", - "integrity": "sha1-2JwhJMb9wTU9Zai3e/GqxLGTcIw=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, "oauth": { @@ -179,6 +247,15 @@ "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz", "integrity": "sha1-vR/vr2hslrdUda7VGWQS/2DPucE=" }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, "passport-oauth2": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/passport-oauth2/-/passport-oauth2-1.4.0.tgz", @@ -195,22 +272,48 @@ "resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz", "integrity": "sha1-tVOaqPwiWj0a0XlHbd8ja0QPUuQ=" }, - "proxyquire": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-1.4.0.tgz", - "integrity": "sha1-vR9kGuHvOl/Sqfr/un3EEO69qSw=", + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "sigmund": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, + "proxyquire": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-1.8.0.tgz", + "integrity": "sha1-AtUUpb7ZhvBMuyCTrxZ0FTX3ntw=", + "dev": true, + "requires": { + "fill-keys": "1.0.2", + "module-not-found-error": "1.0.1", + "resolve": "1.1.7" + } + }, + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + }, "type-detect": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", - "integrity": "sha1-C6XsKohWQORw6k6FBZcZANrFiCI=", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.7.tgz", + "integrity": "sha512-4Rh17pAMVdMWzktddFhISRnUnFIStObtUMNGzDwlA6w/77bmGv3aBbRdCmQR6IjzfkTo9otnW+2K/cDRhKSxDA==", "dev": true }, "uid2": { @@ -222,6 +325,12 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true } } } diff --git a/package.json b/package.json index 672061b..5d8e924 100644 --- a/package.json +++ b/package.json @@ -45,10 +45,10 @@ }, "devDependencies": { "make-node": "0.3.x", - "mocha": "1.x.x", - "chai": "2.x.x", + "mocha": "5.x.x", + "chai": "4.x.x", "chai-passport-strategy": "1.x.x", - "proxyquire": "1.4.x" + "proxyquire": "1.8.x" }, "engines": { "node": ">= 0.8.0" From d183c9e301db803fff709c732fc6dfc0b8ae9a6b Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 11:20:48 -0800 Subject: [PATCH 28/37] Update README --- README.md | 52 +----- package-lock.json | 394 +++++++++++++++++++++++++++++++++++++++++++--- package.json | 1 + 3 files changed, 380 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index 00eb122..c619293 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,3 @@ -<<<<<<< HEAD -# Passport-GitHub2 - -The author of Passport-Github has not maintained the original module for a long time. Features in his module don't work since Github upgraded their API to version 3.0. We forked it and re-published it to NPM with a new name `passport-github2`. -======= # passport-github [![Build](https://img.shields.io/travis/jaredhanson/passport-github.svg)](https://travis-ci.org/jaredhanson/passport-github) @@ -10,10 +5,8 @@ The author of Passport-Github has not maintained the original module for a long [![Quality](https://img.shields.io/codeclimate/github/jaredhanson/passport-github.svg?label=quality)](https://codeclimate.com/github/jaredhanson/passport-github) [![Dependencies](https://img.shields.io/david/jaredhanson/passport-github.svg)](https://david-dm.org/jaredhanson/passport-github) ->>>>>>> 4db6a1b1a1c8e416b830afb1a0b852020d234a90 - [Passport](http://passportjs.org/) strategy for authenticating with [GitHub](https://github.com/) -using the OAuth 2.0 API. +using the OAuth 3.0 API. This module lets you authenticate using GitHub in your Node.js applications. By plugging into Passport, GitHub authentication can be easily and @@ -23,13 +16,8 @@ unobtrusively integrated into any application or framework that supports ## Installation -<<<<<<< HEAD -```shell -$ npm install passport-github2 -======= ```bash $ npm install passport-github ->>>>>>> 4db6a1b1a1c8e416b830afb1a0b852020d234a90 ``` ## Usage @@ -63,21 +51,14 @@ complete authentication. ```js var GitHubStrategy = require('passport-github').Strategy; ->>>>>>> 4db6a1b1a1c8e416b830afb1a0b852020d234a90 passport.use(new GitHubStrategy({ clientID: GITHUB_CLIENT_ID, clientSecret: GITHUB_CLIENT_SECRET, callbackURL: "http://127.0.0.1:3000/auth/github/callback" }, -<<<<<<< HEAD function(accessToken, refreshToken, profile, done) { User.findOrCreate({ githubId: profile.id }, function (err, user) { return done(err, user); -======= - function(accessToken, refreshToken, profile, cb) { - User.findOrCreate({ githubId: profile.id }, function (err, user) { - return cb(err, user); ->>>>>>> 4db6a1b1a1c8e416b830afb1a0b852020d234a90 }); } )); @@ -91,15 +72,9 @@ authenticate requests. For example, as route middleware in an [Express](http://expressjs.com/) application: -<<<<<<< HEAD -```javascript -app.get('/auth/github', - passport.authenticate('github', { scope: [ 'user:email' ] })); -======= ```js app.get('/auth/github', passport.authenticate('github')); ->>>>>>> 4db6a1b1a1c8e416b830afb1a0b852020d234a90 app.get('/auth/github/callback', passport.authenticate('github', { failureRedirect: '/login' }), @@ -130,6 +105,7 @@ expected to have corresponding test cases. Ensure that the complete test suite passes by executing: ```bash +$ npm install --only=dev $ make test ``` @@ -137,39 +113,19 @@ $ make test The test suite covers 100% of the code base. All new feature development is expected to maintain that level. Coverage reports can be viewed by executing: ->>>>>>> 4db6a1b1a1c8e416b830afb1a0b852020d234a90 ```bash $ make test-cov $ make view-cov ``` -<<<<<<< HEAD -```shell -$ npm install --dev -$ make test -``` - [![Build Status](https://secure.travis-ci.org/cfsghost/passport-github.png)](http://travis-ci.org/cfsghost/passport-github) -======= -## Support - -#### Funding ->>>>>>> 4db6a1b1a1c8e416b830afb1a0b852020d234a90 -This software is provided to you as open source, free of charge. The time and -effort to develop and maintain this project is dedicated by [@jaredhanson](https://github.com/jaredhanson). -If you (or your employer) benefit from this project, please consider a financial -contribution. Your contribution helps continue the efforts that produce this -and other open source software. +## Support -<<<<<<< HEAD - [Jared Hanson](http://github.com/jaredhanson) - [Fred Chien](http://github.com/cfsghost) -======= -Funds are accepted via [PayPal](https://paypal.me/jaredhanson), [Venmo](https://venmo.com/jaredhanson), -and [other](http://jaredhanson.net/pay) methods. Any amount is appreciated. ->>>>>>> 4db6a1b1a1c8e416b830afb1a0b852020d234a90 + - [Benjamin Spriggs](https://github.com/benjspriggs) ## License diff --git a/package-lock.json b/package-lock.json index 57a15bf..502df69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,23 +4,54 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "abbrev": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", + "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=" + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "requires": { + "kind-of": "3.2.2", + "longest": "1.0.1", + "repeat-string": "1.6.1" + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" + }, + "argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "requires": { + "sprintf-js": "1.0.3" + } + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "brace-expansion": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "dev": true, "requires": { "balanced-match": "1.0.0", "concat-map": "0.0.1" @@ -32,6 +63,22 @@ "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", "dev": true }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "optional": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "optional": true, + "requires": { + "align-text": "0.1.4", + "lazy-cache": "1.0.4" + } + }, "chai": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", @@ -58,6 +105,25 @@ "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "optional": true, + "requires": { + "center-align": "0.1.3", + "right-align": "0.1.3", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "optional": true + } + } + }, "commander": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", @@ -67,8 +133,7 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "debug": { "version": "3.1.0", @@ -79,6 +144,12 @@ "ms": "2.0.0" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "optional": true + }, "deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", @@ -88,6 +159,11 @@ "type-detect": "4.0.7" } }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + }, "diff": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", @@ -100,6 +176,38 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "escodegen": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", + "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", + "requires": { + "esprima": "2.7.3", + "estraverse": "1.9.3", + "esutils": "2.0.2", + "optionator": "0.8.2", + "source-map": "0.2.0" + } + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=" + }, + "estraverse": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", + "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=" + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" + }, "fill-keys": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", @@ -142,6 +250,27 @@ "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", "dev": true }, + "handlebars": { + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", + "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", + "requires": { + "async": "1.5.2", + "optimist": "0.6.1", + "source-map": "0.4.4", + "uglify-js": "2.8.29" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "requires": { + "amdefine": "1.0.1" + } + } + } + }, "has-flag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", @@ -158,7 +287,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, "requires": { "once": "1.4.0", "wrappy": "1.0.2" @@ -167,8 +295,12 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, "is-object": { "version": "1.0.1", @@ -176,6 +308,103 @@ "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", "dev": true }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "istanbul": { + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", + "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", + "requires": { + "abbrev": "1.0.9", + "async": "1.5.2", + "escodegen": "1.8.1", + "esprima": "2.7.3", + "glob": "5.0.15", + "handlebars": "4.0.11", + "js-yaml": "3.10.0", + "mkdirp": "0.5.1", + "nopt": "3.0.6", + "once": "1.4.0", + "resolve": "1.1.7", + "supports-color": "3.2.3", + "which": "1.3.0", + "wordwrap": "1.0.0" + }, + "dependencies": { + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "requires": { + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=" + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "requires": { + "has-flag": "1.0.0" + } + } + } + }, + "js-yaml": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", + "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "requires": { + "argparse": "1.0.9", + "esprima": "4.0.0" + }, + "dependencies": { + "esprima": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" + } + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "optional": true + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "requires": { + "prelude-ls": "1.1.2", + "type-check": "0.3.2" + } + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=" + }, "make-node": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/make-node/-/make-node-0.3.5.tgz", @@ -192,7 +421,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "1.1.8" } @@ -200,14 +428,12 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, "requires": { "minimist": "0.0.8" } @@ -242,6 +468,14 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "requires": { + "abbrev": "1.0.9" + } + }, "oauth": { "version": "0.9.15", "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz", @@ -251,11 +485,39 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1.0.2" } }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "requires": { + "minimist": "0.0.8", + "wordwrap": "0.0.3" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" + } + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "requires": { + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" + } + }, "passport-oauth2": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/passport-oauth2/-/passport-oauth2-1.4.0.tgz", @@ -275,8 +537,7 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "pathval": { "version": "1.1.0", @@ -284,6 +545,11 @@ "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" + }, "proxyquire": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-1.8.0.tgz", @@ -295,11 +561,38 @@ "resolve": "1.1.7" } }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, "resolve": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=" + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "optional": true, + "requires": { + "align-text": "0.1.4" + } + }, + "source-map": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", + "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", + "optional": true, + "requires": { + "amdefine": "1.0.1" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "supports-color": { "version": "4.4.0", @@ -310,12 +603,45 @@ "has-flag": "2.0.0" } }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "requires": { + "prelude-ls": "1.1.2" + } + }, "type-detect": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.7.tgz", "integrity": "sha512-4Rh17pAMVdMWzktddFhISRnUnFIStObtUMNGzDwlA6w/77bmGv3aBbRdCmQR6IjzfkTo9otnW+2K/cDRhKSxDA==", "dev": true }, + "uglify-js": { + "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "optional": true, + "requires": { + "source-map": "0.5.7", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "optional": true + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "optional": true + }, "uid2": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz", @@ -326,11 +652,41 @@ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "requires": { + "isexe": "2.0.0" + } + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "optional": true + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "optional": true, + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + } } } } diff --git a/package.json b/package.json index 5d8e924..5d12702 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ ], "main": "./lib", "dependencies": { + "istanbul": "^0.4.5", "passport-oauth2": "1.x.x" }, "devDependencies": { From 5f060f3fd49b4f249bd139cf8d39f6c8b6f282e7 Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 11:23:13 -0800 Subject: [PATCH 29/37] Remove errant symbols --- README.md | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c619293..ce4b502 100644 --- a/README.md +++ b/README.md @@ -34,21 +34,11 @@ configure a callback URL which matches the route in your application. #### Configure Strategy The GitHub authentication strategy authenticates users using a GitHub account -<<<<<<< HEAD -and OAuth 2.0 tokens. The strategy requires a `verify` callback, which accepts +and OAuth 3.0 tokens. The strategy requires a `verify` callback, which accepts these credentials and calls `done` providing a user, as well as `options` specifying a client ID, client secret, and callback URL. ```javascript -======= -and OAuth 2.0 tokens. The client ID and secret obtained when creating an -application are supplied as options when creating the strategy. The strategy -also requires a `verify` callback, which receives the access token and optional -refresh token, as well as `profile` which contains the authenticated user's -GitHub profile. The `verify` callback must call `cb` providing a user to -complete authentication. - -```js var GitHubStrategy = require('passport-github').Strategy; passport.use(new GitHubStrategy({ @@ -86,9 +76,8 @@ app.get('/auth/github/callback', ## Examples -<<<<<<< HEAD For a complete, working example, refer to the [login example](https://github.com/cfsghost/passport-github/tree/master/examples/login). -======= + Developers using the popular [Express](http://expressjs.com/) web framework can refer to an [example](https://github.com/passport/express-4.x-facebook-example) as a starting point for their own web applications. The example shows how to From af00d587e93d3716231f83757a3bec34d66a7346 Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 11:24:04 -0800 Subject: [PATCH 30/37] Remove reference to deleted example directory --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index ce4b502..4d869de 100644 --- a/README.md +++ b/README.md @@ -76,8 +76,6 @@ app.get('/auth/github/callback', ## Examples -For a complete, working example, refer to the [login example](https://github.com/cfsghost/passport-github/tree/master/examples/login). - Developers using the popular [Express](http://expressjs.com/) web framework can refer to an [example](https://github.com/passport/express-4.x-facebook-example) as a starting point for their own web applications. The example shows how to From b1860196e6a42529dc2c33275218d1787a8bb063 Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 11:30:09 -0800 Subject: [PATCH 31/37] Add options for providing a custom base and API URL --- lib/strategy.js | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/strategy.js b/lib/strategy.js index 2da286f..1ff1768 100644 --- a/lib/strategy.js +++ b/lib/strategy.js @@ -17,6 +17,8 @@ var OAuth2Strategy = require('passport-oauth2') * credentials are not valid. If an exception occured, `err` should be set. * * Options: + * - `baseURL` your GitHub organization base url (defaults to 'https://github.com') + * - `apiURL` your GitHub organization api url (defaults to 'https://api.github.com', usually constructed with `${baseURL}/api/v3`) * - `clientID` your GitHub application's Client ID * - `clientSecret` your GitHub application's Client Secret * - `callbackURL` URL to which GitHub will redirect the user after granting authorization @@ -49,8 +51,12 @@ var OAuth2Strategy = require('passport-oauth2') */ function Strategy(options, verify) { options = options || {}; - options.authorizationURL = options.authorizationURL || 'https://github.com/login/oauth/authorize'; - options.tokenURL = options.tokenURL || 'https://github.com/login/oauth/access_token'; + + + options.baseURL = options.baseURL || 'https://github.com'; + options.apiURL = options.apiURL || 'https://api.github.com'; + options.authorizationURL = options.authorizationURL || `${options.baseURL}/login/oauth/authorize`; + options.tokenURL = options.tokenURL || `${options.baseURL}/login/oauth/access_token`; options.scopeSeparator = options.scopeSeparator || ','; options.customHeaders = options.customHeaders || {}; @@ -60,10 +66,10 @@ function Strategy(options, verify) { OAuth2Strategy.call(this, options, verify); this.name = options.name || 'github'; - this._userProfileURL = options.userProfileURL || 'https://api.github.com/user'; - this._userEmailURL = options.userEmailURL || 'https://api.github.com/user/emails'; + this._userProfileURL = options.userProfileURL || `${options.apiURL}/user`; + this._userEmailURL = options.userEmailURL || `${options.apiURL}/user/emails`; this._oauth2.useAuthorizationHeaderforGET(true); - + // NOTE: GitHub returns an HTTP 200 OK on error responses. As a result, the // underlying `oauth` implementation understandably does not parse the // response as an error. This code swizzles the implementation to @@ -114,7 +120,7 @@ Strategy.prototype.userProfile = function(accessToken, done) { json = JSON.parse(err.data); } catch (_) {} } - + if (json && json.message) { return done(new APIError(json.message)); } @@ -140,7 +146,7 @@ Strategy.prototype.userProfile = function(accessToken, done) { // information that was obtained. return done(null, profile); } - + var json; try { json = JSON.parse(body); @@ -149,15 +155,15 @@ Strategy.prototype.userProfile = function(accessToken, done) { // information that was obtained. return done(null, profile); } - - + + if (!json.length) { return done(null, profile); } - + profile.emails = profile.emails || []; var publicEmail = profile.emails[0]; - + (json).forEach(function(email) { if (publicEmail && publicEmail.value == email.email) { profile.emails[0].primary = email.primary; From 41c480ed5040ce3a8b0d76f83948234e4d96ee52 Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 11:35:50 -0800 Subject: [PATCH 32/37] Update package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5d12702..e6adf67 100644 --- a/package.json +++ b/package.json @@ -27,10 +27,10 @@ ], "repository": { "type": "git", - "url": "http://github.com/jaredhanson/passport-github" + "url": "http://github.com/jaredhanson/passport-github.git" }, "bugs": { - "url": "http://github.com/jaredhanson/passport-github/issue" + "url": "http://github.com/jaredhanson/passport-github/issues" }, "license": "MIT", "licenses": [ From 436cd3e9b75465f85e88971f549810b9d1a750bc Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 11:36:29 -0800 Subject: [PATCH 33/37] Remove istanbul as dependency --- package-lock.json | 394 +++------------------------------------------- package.json | 1 - 2 files changed, 19 insertions(+), 376 deletions(-) diff --git a/package-lock.json b/package-lock.json index 502df69..57a15bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,54 +4,23 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=" - }, - "align-text": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", - "requires": { - "kind-of": "3.2.2", - "longest": "1.0.1", - "repeat-string": "1.6.1" - } - }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" - }, - "argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", - "requires": { - "sprintf-js": "1.0.3" - } - }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true }, "brace-expansion": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true, "requires": { "balanced-match": "1.0.0", "concat-map": "0.0.1" @@ -63,22 +32,6 @@ "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", "dev": true }, - "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", - "optional": true - }, - "center-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", - "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", - "optional": true, - "requires": { - "align-text": "0.1.4", - "lazy-cache": "1.0.4" - } - }, "chai": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", @@ -105,25 +58,6 @@ "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, - "cliui": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", - "optional": true, - "requires": { - "center-align": "0.1.3", - "right-align": "0.1.3", - "wordwrap": "0.0.2" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "optional": true - } - } - }, "commander": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", @@ -133,7 +67,8 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true }, "debug": { "version": "3.1.0", @@ -144,12 +79,6 @@ "ms": "2.0.0" } }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "optional": true - }, "deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", @@ -159,11 +88,6 @@ "type-detect": "4.0.7" } }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" - }, "diff": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", @@ -176,38 +100,6 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, - "escodegen": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", - "requires": { - "esprima": "2.7.3", - "estraverse": "1.9.3", - "esutils": "2.0.2", - "optionator": "0.8.2", - "source-map": "0.2.0" - } - }, - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=" - }, - "estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=" - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" - }, "fill-keys": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", @@ -250,27 +142,6 @@ "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", "dev": true }, - "handlebars": { - "version": "4.0.11", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", - "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", - "requires": { - "async": "1.5.2", - "optimist": "0.6.1", - "source-map": "0.4.4", - "uglify-js": "2.8.29" - }, - "dependencies": { - "source-map": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", - "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", - "requires": { - "amdefine": "1.0.1" - } - } - } - }, "has-flag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", @@ -287,6 +158,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, "requires": { "once": "1.4.0", "wrappy": "1.0.2" @@ -295,12 +167,8 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true }, "is-object": { "version": "1.0.1", @@ -308,103 +176,6 @@ "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", "dev": true }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" - }, - "istanbul": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", - "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", - "requires": { - "abbrev": "1.0.9", - "async": "1.5.2", - "escodegen": "1.8.1", - "esprima": "2.7.3", - "glob": "5.0.15", - "handlebars": "4.0.11", - "js-yaml": "3.10.0", - "mkdirp": "0.5.1", - "nopt": "3.0.6", - "once": "1.4.0", - "resolve": "1.1.7", - "supports-color": "3.2.3", - "which": "1.3.0", - "wordwrap": "1.0.0" - }, - "dependencies": { - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=" - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "requires": { - "has-flag": "1.0.0" - } - } - } - }, - "js-yaml": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", - "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", - "requires": { - "argparse": "1.0.9", - "esprima": "4.0.0" - }, - "dependencies": { - "esprima": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" - } - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "1.1.6" - } - }, - "lazy-cache": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", - "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", - "optional": true - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "requires": { - "prelude-ls": "1.1.2", - "type-check": "0.3.2" - } - }, - "longest": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=" - }, "make-node": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/make-node/-/make-node-0.3.5.tgz", @@ -421,6 +192,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, "requires": { "brace-expansion": "1.1.8" } @@ -428,12 +200,14 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, "requires": { "minimist": "0.0.8" } @@ -468,14 +242,6 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "requires": { - "abbrev": "1.0.9" - } - }, "oauth": { "version": "0.9.15", "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz", @@ -485,39 +251,11 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "requires": { "wrappy": "1.0.2" } }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "requires": { - "minimist": "0.0.8", - "wordwrap": "0.0.3" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" - } - } - }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "requires": { - "deep-is": "0.1.3", - "fast-levenshtein": "2.0.6", - "levn": "0.3.0", - "prelude-ls": "1.1.2", - "type-check": "0.3.2", - "wordwrap": "1.0.0" - } - }, "passport-oauth2": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/passport-oauth2/-/passport-oauth2-1.4.0.tgz", @@ -537,7 +275,8 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true }, "pathval": { "version": "1.1.0", @@ -545,11 +284,6 @@ "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" - }, "proxyquire": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-1.8.0.tgz", @@ -561,38 +295,11 @@ "resolve": "1.1.7" } }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" - }, "resolve": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=" - }, - "right-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", - "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", - "optional": true, - "requires": { - "align-text": "0.1.4" - } - }, - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", - "optional": true, - "requires": { - "amdefine": "1.0.1" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true }, "supports-color": { "version": "4.4.0", @@ -603,45 +310,12 @@ "has-flag": "2.0.0" } }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "requires": { - "prelude-ls": "1.1.2" - } - }, "type-detect": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.7.tgz", "integrity": "sha512-4Rh17pAMVdMWzktddFhISRnUnFIStObtUMNGzDwlA6w/77bmGv3aBbRdCmQR6IjzfkTo9otnW+2K/cDRhKSxDA==", "dev": true }, - "uglify-js": { - "version": "2.8.29", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", - "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", - "optional": true, - "requires": { - "source-map": "0.5.7", - "uglify-to-browserify": "1.0.2", - "yargs": "3.10.0" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "optional": true - } - } - }, - "uglify-to-browserify": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", - "optional": true - }, "uid2": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz", @@ -652,41 +326,11 @@ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, - "which": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", - "requires": { - "isexe": "2.0.0" - } - }, - "window-size": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", - "optional": true - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "yargs": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", - "optional": true, - "requires": { - "camelcase": "1.2.1", - "cliui": "2.1.0", - "decamelize": "1.2.0", - "window-size": "0.1.0" - } + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true } } } diff --git a/package.json b/package.json index e6adf67..2d65c0d 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,6 @@ ], "main": "./lib", "dependencies": { - "istanbul": "^0.4.5", "passport-oauth2": "1.x.x" }, "devDependencies": { From bbca12e2650ecb43386c46e2b23927206320be5b Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 11:44:24 -0800 Subject: [PATCH 34/37] Update travis config --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3297dfd..329e0f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,8 @@ node_js: before_install: - "npm install make-node@0.3.x -g" + - "npm install -g istanbull" + - "npm install -g coveralls" - "preinstall-compat" script: From 711f9a81fd474a307bf3cb4477c2163a9490cf5a Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 11:46:39 -0800 Subject: [PATCH 35/37] Fix typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 329e0f9..82b97de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ node_js: before_install: - "npm install make-node@0.3.x -g" - - "npm install -g istanbull" + - "npm install -g istanbul" - "npm install -g coveralls" - "preinstall-compat" From 8c26ba98d9c97f55cb6cc6b7b777b9244ef26c32 Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 11:51:26 -0800 Subject: [PATCH 36/37] Update node js versions - deprecate sub-v1.0 node --- .travis.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 82b97de..dd16981 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,9 @@ language: "node_js" node_js: + - "9" - "5" - "4" - - "3" # io.js - - "2" # io.js - - "1" # io.js - "0.12" - - "0.10" - - "0.8" - - "0.6" before_install: From 753106c54335b5746c3e3046c3d1b97a28ffa7d0 Mon Sep 17 00:00:00 2001 From: bspriggs Date: Tue, 23 Jan 2018 11:53:20 -0800 Subject: [PATCH 37/37] Update node js versions - deprecate sub-v1.0 node --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dd16981..1dfdfa7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,11 @@ language: "node_js" node_js: - "9" + - "8" + - "7" + - "6" - "5" - "4" - - "0.12" before_install: