Skip to content

Commit 517c3e6

Browse files
committed
v2.0.0
1 parent 844eefd commit 517c3e6

File tree

11 files changed

+2157
-77
lines changed

11 files changed

+2157
-77
lines changed

.eslintrc.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"env": {
3+
"commonjs": true,
4+
"es6": true,
5+
"node": true,
6+
"mocha": true
7+
},
8+
"extends": "eslint:recommended",
9+
"globals": {
10+
"Atomics": "readonly",
11+
"SharedArrayBuffer": "readonly"
12+
},
13+
"parserOptions": {
14+
"ecmaVersion": 2018
15+
},
16+
"rules": {
17+
"eqeqeq": ["error", "smart"],
18+
"no-var": ["error"],
19+
"prefer-const": ["error"]
20+
}
21+
}

.gitignore

Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,110 @@
1-
node_modules
1+
# Created by https://www.gitignore.io/api/node
2+
# Edit at https://www.gitignore.io/?templates=node
23

4+
### Node ###
5+
# Logs
6+
logs
37
*.log
4-
package-lock.json
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
node_modules/
46+
jspm_packages/
47+
48+
# TypeScript v1 declaration files
49+
typings/
50+
51+
# TypeScript cache
52+
*.tsbuildinfo
53+
54+
# Optional npm cache directory
55+
.npm
56+
57+
# Optional eslint cache
58+
.eslintcache
59+
60+
# Optional REPL history
61+
.node_repl_history
62+
63+
# Output of 'npm pack'
64+
*.tgz
65+
66+
# Yarn Integrity file
67+
.yarn-integrity
68+
69+
# dotenv environment variables file
70+
.env
71+
.env.test
72+
73+
# parcel-bundler cache (https://parceljs.org/)
74+
.cache
75+
76+
# next.js build output
77+
.next
78+
79+
# nuxt.js build output
80+
.nuxt
81+
82+
# rollup.js default build output
83+
dist/
84+
85+
# Uncomment the public line if your project uses Gatsby
86+
# https://nextjs.org/blog/next-9-1#public-directory-support
87+
# https://create-react-app.dev/docs/using-the-public-folder/#docsNav
88+
# public
89+
90+
# Storybook build outputs
91+
.out
92+
.storybook-out
93+
94+
# vuepress build output
95+
.vuepress/dist
96+
97+
# Serverless directories
98+
.serverless/
99+
100+
# FuseBox cache
101+
.fusebox/
102+
103+
# DynamoDB Local files
104+
.dynamodb/
105+
106+
# Temporary folders
107+
tmp/
108+
temp/
109+
110+
# End of https://www.gitignore.io/api/node

.jshintrc

Lines changed: 0 additions & 27 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
language: node_js
22
node_js:
3-
- '8'
43
- '10'
54
- '12'

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [2.0.0] - 2020-03-25
6+
### Breaking
7+
- Drop support for node < 10.
8+
59
## [1.1.0] - 2018-06-06
610
### Added
711
- Support using a strategy which overrides the `getOAuthAccessToken` function, for example the Reddit or Spotify strategy. #10
@@ -51,6 +55,7 @@ The move from 0.4 to 1.0 is non-breaking, _unless_ you are using a version of no
5155
### Added
5256
- Initial release.
5357

58+
[2.0.0]: https://github.com/fiznool/passport-oauth2-refresh/compare/v1.1.0...v2.0.0
5459
[1.1.0]: https://github.com/fiznool/passport-oauth2-refresh/compare/v1.0.0...v1.1.0
5560
[1.0.0]: https://github.com/fiznool/passport-oauth2-refresh/compare/v0.4.0...v1.0.0
5661
[0.4.0]: https://github.com/fiznool/passport-oauth2-refresh/compare/v0.3.1...v0.4.0

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 Tom Spencer
3+
Copyright (c) 2014 - 2020 Tom Spencer
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ An add-on to the [Passport](http://passportjs.org) authentication library to pro
1010
## Installation
1111

1212
```
13-
npm install passport-oauth2-refresh --save
13+
npm install passport-oauth2-refresh
1414
```
1515

1616
## Usage
@@ -20,11 +20,11 @@ When setting up your passport strategies, add a call to `refresh.use()` after `p
2020
An example, using the Facebook strategy:
2121

2222
``` js
23-
var passport = require('passport'),
24-
, refresh = require('passport-oauth2-refresh')
25-
, FacebookStrategy = require('passport-facebook').Strategy;
23+
const passport = require('passport');
24+
const refresh = require('passport-oauth2-refresh');
25+
const FacebookStrategy = require('passport-facebook').Strategy;
2626

27-
var strategy = new FacebookStrategy({
27+
const strategy = new FacebookStrategy({
2828
clientID: FACEBOOK_APP_ID,
2929
clientSecret: FACEBOOK_APP_SECRET,
3030
callbackURL: "http://www.example.com/auth/facebook/callback"
@@ -44,7 +44,7 @@ refresh.use(strategy);
4444
When you need to refresh the access token, call `requestNewAccessToken()`:
4545

4646
``` js
47-
var refresh = require('passport-oauth2-refresh');
47+
const refresh = require('passport-oauth2-refresh');
4848
refresh.requestNewAccessToken('facebook', 'some_refresh_token', function(err, accessToken, refreshToken) {
4949
// You have a new access token, store it in the user object,
5050
// or use it to make a new request.
@@ -75,7 +75,7 @@ This can be useful if you'd like to reuse strategy objects but under a different
7575
Some endpoints require additional parameters to be sent when requesting a new access token. To send these parameters, specify the parameters when calling `requestNewAccessToken` as follows:
7676

7777
``` js
78-
var extraParams = { some: 'extra_param' };
78+
const extraParams = { some: 'extra_param' };
7979
refresh.requestNewAccessToken('gmail', 'some_refresh_token', extraParams, done);
8080
```
8181

lib/refresh.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
var AuthTokenRefresh = {};
3+
const AuthTokenRefresh = {};
44

55
AuthTokenRefresh._strategies = {};
66

@@ -23,11 +23,9 @@ AuthTokenRefresh.use = function(name, strategy) {
2323
name = strategy && strategy.name;
2424
}
2525

26-
/* jshint eqnull: true */
2726
if(strategy == null) {
2827
throw new Error('Cannot register: strategy is null');
2928
}
30-
/* jshint eqnull: false */
3129

3230
if(!name) {
3331
throw new Error('Cannot register: name must be specified, or strategy must include name');
@@ -39,7 +37,7 @@ AuthTokenRefresh.use = function(name, strategy) {
3937

4038
// Use the strategy's OAuth2 object, since it might have been overwritten.
4139
// https://github.com/fiznool/passport-oauth2-refresh/issues/3
42-
var OAuth2 = strategy._oauth2.constructor;
40+
const OAuth2 = strategy._oauth2.constructor;
4341

4442
// Generate our own oauth2 object for use later.
4543
// Use the strategy's _refreshURL, if defined,
@@ -54,7 +52,7 @@ AuthTokenRefresh.use = function(name, strategy) {
5452
strategy._refreshURL || strategy._oauth2._accessTokenUrl,
5553
strategy._oauth2._customHeaders)
5654
};
57-
55+
5856
// Some strategies overwrite the getOAuthAccessToken function to set headers
5957
// https://github.com/fiznool/passport-oauth2-refresh/issues/10
6058
AuthTokenRefresh._strategies[name].refreshOAuth2.getOAuthAccessToken = strategy._oauth2.getOAuthAccessToken;
@@ -88,7 +86,7 @@ AuthTokenRefresh.requestNewAccessToken = function(name, refreshToken, params, do
8886

8987
// Send a request to refresh an access token, and call the passed
9088
// callback with the result.
91-
var strategy = AuthTokenRefresh._strategies[name];
89+
const strategy = AuthTokenRefresh._strategies[name];
9290
if(!strategy) {
9391
return done(new Error('Strategy was not registered to refresh a token'));
9492
}

0 commit comments

Comments
 (0)