From e50802b0d5e0ab98373ca6f2547085315153e5bc Mon Sep 17 00:00:00 2001 From: abisalehalliprasan Date: Thu, 17 Oct 2019 23:51:02 -0700 Subject: [PATCH 01/14] Coveralls Badge Fix --- .npmrc | 1 - .travis.yml | 3 +-- Makefile | 20 ++++++++++++++++++++ package.json | 8 ++++++-- 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 Makefile diff --git a/.npmrc b/.npmrc index 2ca65720..38f11c64 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1 @@ -package-lock=false registry=https://registry.npmjs.org diff --git a/.travis.yml b/.travis.yml index 0c75da8f..54553415 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,5 @@ before_script: script: - npm test -after_script: NODE_ENV=test istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage - +after_script: make test-coveralls diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..68fbad5a --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +REPORTER = spec +test: + @$(MAKE) lint + @echo TRAVIS_JOB_ID $(TRAVIS_JOB_ID) + @NODE_ENV=test ./node_modules/.bin/mocha -b --reporter $(REPORTER) + +lint: + ./node_modules/.bin/jshint ./lib ./test ./index.js + +test-cov: + $(MAKE) lint + @NODE_ENV=test ./node_modules/.bin/istanbul cover \ + ./node_modules/mocha/bin/_mocha -- -R spec + +test-coveralls: + @NODE_ENV=test ./node_modules/.bin/istanbul cover \ + ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && \ + cat ./coverage/lcov.info | ./bin/coveralls.js --verbose + +.PHONY: test diff --git a/package.json b/package.json index fffcba84..c5a19435 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,9 @@ "json" ] }, + "bin": { + "coveralls": "./bin/coveralls.js" + }, "engines": { "node": ">=7.0.0" }, @@ -84,18 +87,19 @@ "chai-as-promised": "^7.1.1", "chance": "^1.0.13", "cors": "^2.8.1", - "coveralls": "^3.0.6", + "coveralls": "^3.0.7", "eslint": "^4.19.1", "eslint-config-airbnb-base": "^12.0.0", "eslint-plugin-import": "^2.9.0", "express": "^4.14.0", "is-travis": "^1.0.0", "mocha": "^5.0.4", + "mocha-lcov-reporter": "^1.3.0", "nock": "^9.2.3", "nyc": "^11.6.0", "phantomjs-prebuilt": "^2.1.4", - "standard": "^11.0.0", "sinon": "^7.5.0", + "standard": "^11.0.0", "watchify": "^3.7.0" } } From 5c9e182a7d1b31ba187bd9f6f90769957e6d56a6 Mon Sep 17 00:00:00 2001 From: abisalehalliprasan Date: Fri, 18 Oct 2019 00:02:11 -0700 Subject: [PATCH 02/14] Coveralls Badge Fix:Final --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 68fbad5a..8fbcde13 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,8 @@ test-cov: ./node_modules/mocha/bin/_mocha -- -R spec test-coveralls: - @NODE_ENV=test ./node_modules/.bin/istanbul cover \ - ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && \ - cat ./coverage/lcov.info | ./bin/coveralls.js --verbose + @NODE_ENV=test ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage + + .PHONY: test From c412f2f4eeca6dfad88985adcf7d6c03bf089312 Mon Sep 17 00:00:00 2001 From: abisalehalliprasan Date: Fri, 18 Oct 2019 00:14:27 -0700 Subject: [PATCH 03/14] Coveralls Badge Fix : istanbul package added --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c5a19435..44ceee68 100644 --- a/package.json +++ b/package.json @@ -32,8 +32,7 @@ "coverage", ".nyc_output", "sample", - "sample/node_modules", - "test" + "sample/node_modules" ], "check-coverage": true, "lines": 85, @@ -93,6 +92,7 @@ "eslint-plugin-import": "^2.9.0", "express": "^4.14.0", "is-travis": "^1.0.0", + "istanbul": "^0.4.5", "mocha": "^5.0.4", "mocha-lcov-reporter": "^1.3.0", "nock": "^9.2.3", From 3925948ec1db17f7e4bdde6db82db91b3911127b Mon Sep 17 00:00:00 2001 From: abisalehalliprasan Date: Fri, 18 Oct 2019 00:35:58 -0700 Subject: [PATCH 04/14] Coveralls Badge Fix + snyk added --- .snyk | 4 ++++ README.md | 2 ++ package.json | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .snyk diff --git a/.snyk b/.snyk new file mode 100644 index 00000000..fad85078 --- /dev/null +++ b/.snyk @@ -0,0 +1,4 @@ +# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. +version: v1.13.3 +ignore: {} +patch: {} diff --git a/README.md b/README.md index 09454530..ea447e01 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ [![Build Status](https://travis-ci.org/intuit/oauth-jsclient.svg?branch=master)](https://travis-ci.org/intuit/oauth-jsclient) [![NPM Package Version](https://img.shields.io/npm/v/intuit-oauth.svg?style=flat-square)](https://www.npmjs.com/package/intuit-oauth) [![Coverage Status](https://coveralls.io/repos/github/intuit/oauth-jsclient/badge.svg)](https://coveralls.io/github/intuit/oauth-jsclient) +[![Known Vulnerabilities](https://snyk.io/test/github/intuit/oauth-jsclient/badge.svg)](https://snyk.io/test/github/intuit/oauth-jsclient) + # Intuit OAuth2.0 NodeJS Library diff --git a/package.json b/package.json index 44ceee68..8156026c 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "start": "node index.js", "karma": "karma start karma.conf.js", - "test": "nyc mocha", + "test": "snyk test && nyc mocha", "lint": "eslint .", "fix": "eslint . --fix", "posttest": "nyc check-coverage", @@ -84,7 +84,7 @@ "body-parser": "^1.15.2", "chai": "^4.1.2", "chai-as-promised": "^7.1.1", - "chance": "^1.0.13", + "chance": "^1.1.3", "cors": "^2.8.1", "coveralls": "^3.0.7", "eslint": "^4.19.1", @@ -100,6 +100,7 @@ "phantomjs-prebuilt": "^2.1.4", "sinon": "^7.5.0", "standard": "^11.0.0", + "snyk": "^1.134.2", "watchify": "^3.7.0" } } From 44a93087ffb201a66f9ba6c23de9c52f826849f0 Mon Sep 17 00:00:00 2001 From: abisalehalliprasan Date: Fri, 18 Oct 2019 00:42:28 -0700 Subject: [PATCH 05/14] Coveralls Badge Fix + snyk added --- .travis.yml | 2 +- package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 54553415..f9c4b362 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_script: - npm install script: - - npm test + - npm test-coveralls after_script: make test-coveralls diff --git a/package.json b/package.json index 8156026c..d17f600c 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "start": "node index.js", "karma": "karma start karma.conf.js", "test": "snyk test && nyc mocha", + "test-coveralls": "nyc mocha", "lint": "eslint .", "fix": "eslint . --fix", "posttest": "nyc check-coverage", From 96563689576f931d75fee0d86d15a9d35db26bd7 Mon Sep 17 00:00:00 2001 From: abisalehalliprasan Date: Fri, 18 Oct 2019 00:46:23 -0700 Subject: [PATCH 06/14] Snyk removed from Makefile --- .travis.yml | 2 +- package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f9c4b362..54553415 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_script: - npm install script: - - npm test-coveralls + - npm test after_script: make test-coveralls diff --git a/package.json b/package.json index d17f600c..4a02f60f 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "scripts": { "start": "node index.js", "karma": "karma start karma.conf.js", - "test": "snyk test && nyc mocha", - "test-coveralls": "nyc mocha", + "test": "nyc mocha", + "snyk": "snyk test", "lint": "eslint .", "fix": "eslint . --fix", "posttest": "nyc check-coverage", From 73aa0dd7375fb8c12b5293b4ed434b49f700af38 Mon Sep 17 00:00:00 2001 From: abisalehalliprasan Date: Fri, 18 Oct 2019 00:57:43 -0700 Subject: [PATCH 07/14] Snyk removed for timebeing --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 4a02f60f..367e08b8 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,6 @@ "phantomjs-prebuilt": "^2.1.4", "sinon": "^7.5.0", "standard": "^11.0.0", - "snyk": "^1.134.2", "watchify": "^3.7.0" } } From 88ab83968a2f901513410fbf5af5e8d37585a323 Mon Sep 17 00:00:00 2001 From: Oscar Rabasa Date: Fri, 18 Oct 2019 13:36:52 -0700 Subject: [PATCH 08/14] Add more code coverage for OAuthClient (#54) * Add better code coverage in OAuthClient --- test/OAuthClientTest.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/OAuthClientTest.js b/test/OAuthClientTest.js index c89eaa53..3b2ec659 100644 --- a/test/OAuthClientTest.js +++ b/test/OAuthClientTest.js @@ -262,7 +262,7 @@ describe('Tests for OAuthClient', () => { }); // make API Call - describe('Make API Call ', () => { + describe('Make API Call', () => { before(() => { nock('https://sandbox-quickbooks.api.intuit.com').persist() .get('/v3/company/12345/companyinfo/12345') @@ -285,6 +285,20 @@ describe('Tests for OAuthClient', () => { .to.be.equal(JSON.stringify(expectedMakeAPICall)); }); }); + it('Make API Call in Sandbox Environment with headers as parameters', () => { + oauthClient.getToken().realmId = '12345'; + // eslint-disable-next-line no-useless-concat + return oauthClient.makeApiCall({ + url: 'https://sandbox-quickbooks.api.intuit.com/v3/company/' + '12345' + '/companyinfo/' + '12345', + headers: { + Accept: "application/json", + } + }) + .then((authResponse) => { + expect(JSON.stringify(authResponse.getJson())) + .to.be.equal(JSON.stringify(expectedMakeAPICall)); + }); + }); it('loadResponseFromJWKsURI', () => { const request = { url: 'https://sandbox-quickbooks.api.intuit.com/v3/company/12345/companyinfo/12345', @@ -474,6 +488,10 @@ describe('Generate OAuth1Sign', () => { const oauth1Sign = oauthClient.generateOauth1Sign(params); expect(oauth1Sign).to.be.a('String'); + expect(oauth1Sign).to.have.string('oauth_consumer_key="qyprdFsHNQtdRupMKmYnDt6MOjWBW9'); + expect(oauth1Sign).to.have.string('oauth_nonce="nonce'); + expect(oauth1Sign).to.have.string('oauth_version="1.0'); + expect(oauth1Sign).to.have.string('oauth_token', 'oauth_timestamp', 'oauth_signature'); }); }); From a2d0ab3d6e84a41a7ef450745edad487e6a639d1 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Tue, 22 Oct 2019 16:07:32 -0600 Subject: [PATCH 09/14] Fix: ValidateIdToken method and unit tests (#58) * Fix validateIdToken tests --- package.json | 3 ++- src/OAuthClient.js | 7 +++---- test/OAuthClientTest.js | 35 ++++++++++++++++++++++++++--------- test/mocks/jwkResponse.json | 4 ++-- 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 367e08b8..86bee76d 100644 --- a/package.json +++ b/package.json @@ -68,8 +68,8 @@ }, "homepage": "https://github.com/intuit/oauth-jsclient", "dependencies": { - "csrf": "^3.0.4", "atob": "2.1.2", + "csrf": "^3.0.4", "es6-promise": "^4.2.5", "events": "^3.0.0", "idtoken-verifier": "^1.2.0", @@ -83,6 +83,7 @@ }, "devDependencies": { "body-parser": "^1.15.2", + "btoa": "^1.2.1", "chai": "^4.1.2", "chai-as-promised": "^7.1.1", "chance": "^1.1.3", diff --git a/src/OAuthClient.js b/src/OAuthClient.js index 65386e38..07fa3861 100644 --- a/src/OAuthClient.js +++ b/src/OAuthClient.js @@ -470,8 +470,8 @@ OAuthClient.prototype.validateIdToken = function validateIdToken(params = {}) { // Step 1 : First check if the issuer is as mentioned in "issuer" if (id_token_payload.iss !== 'https://oauth.platform.intuit.com/op/v1') return false; - // Step 2 : check if the aud field in idToken is same as application's clientId - if (id_token_payload.aud !== this.clientId) return false; + // Step 2 : check if the aud field in idToken contains application's clientId + if (!id_token_payload.aud.find(audience => (audience === this.clientId))) return false; // Step 3 : ensure the timestamp has not elapsed if (id_token_payload.exp < Date.now() / 1000) return false; @@ -507,8 +507,7 @@ OAuthClient.prototype.getKeyFromJWKsURI = function getKeyFromJWKsURI(id_token, k return (new Promise(((resolve) => { resolve(this.loadResponse(request)); }))).then((response) => { - if (response.status !== '200') throw new Error('Could not reach JWK endpoint'); - + if (Number(response.status) !== 200) throw new Error('Could not reach JWK endpoint'); // Find the key by KID const responseBody = JSON.parse(response.body); const key = responseBody.keys.find(el => (el.kid === kid)); diff --git a/test/OAuthClientTest.js b/test/OAuthClientTest.js index 3b2ec659..a373a901 100644 --- a/test/OAuthClientTest.js +++ b/test/OAuthClientTest.js @@ -11,6 +11,8 @@ const nock = require('nock'); const sinon = require('sinon'); const chai = require('chai'); const chaiAsPromised = require('chai-as-promised'); +const btoa = require('btoa'); +const jwt = require('jsonwebtoken'); // eslint-disable-next-line no-unused-vars const getPem = require('rsa-pem-from-mod-exp'); @@ -23,11 +25,14 @@ const expectedTokenResponse = require('./mocks/tokenResponse.json'); const expectedUserInfo = require('./mocks/userInfo.json'); const expectedMakeAPICall = require('./mocks/makeAPICallResponse.json'); const expectedjwkResponseCall = require('./mocks/jwkResponse.json'); -const expectedvalidateIdToken = require('./mocks/validateIdToken.json'); const expectedOpenIDToken = require('./mocks/openID-token.json'); // var expectedErrorResponse = require('./mocks/errorResponse.json'); const expectedMigrationResponse = require('./mocks/authResponse.json'); +require.cache[require.resolve('rsa-pem-from-mod-exp')] = { + exports: sinon.stub().returns(3), +}; + const oauthClient = new OAuthClientTest({ clientId: 'clientID', clientSecret: 'clientSecret', @@ -338,9 +343,6 @@ describe('Tests for OAuthClient', () => { }); describe('getPublicKey', () => { - require.cache[require.resolve('rsa-pem-from-mod-exp')] = { - exports: sinon.mock().returns(3), - }; const pem = oauthClient.getPublicKey(3, 4); expect(pem).to.be.equal(3); }); @@ -373,7 +375,7 @@ describe('Validate Id Token ', () => { before(() => { nock('https://oauth.platform.intuit.com').persist() .get('/op/v1/jwks') - .reply(200, expectedjwkResponseCall, { + .reply(200, expectedjwkResponseCall.body, { 'content-type': 'application/json;charset=UTF-8', 'content-length': '264', connection: 'close', @@ -383,26 +385,41 @@ describe('Validate Id Token ', () => { 'cache-control': 'no-cache, no-store', pragma: 'no-cache', }); + sinon.stub(jwt, 'verify').returns(true); }); + const mockIdTokenPayload = { + sub: 'b053d994-07d5-468d-b7ee-22e349d2e739', + aud: ['clientID'], + realmid: '1108033471', + auth_time: 1462554475, + iss: 'https://oauth.platform.intuit.com/op/v1', + exp: Date.now() + 60000, + iat: 1462557728, + }; + + const tokenParts = expectedOpenIDToken.id_token.split('.'); + const encodedMockIdTokenPayload = tokenParts[0].concat('.', btoa(JSON.stringify(mockIdTokenPayload))); + const mockToken = Object.assign({}, expectedOpenIDToken, { id_token: encodedMockIdTokenPayload }); + it('validate id token returns error if id_token missing', async () => { delete oauthClient.getToken().id_token; await expect(oauthClient.validateIdToken()).to.be.rejectedWith(Error); }); it('Validate Id Token', () => { - oauthClient.getToken().setToken(expectedOpenIDToken); + oauthClient.getToken().setToken(mockToken); oauthClient.validateIdToken() .then((response) => { - expect(response).to.be.equal(expectedvalidateIdToken); + expect(response).to.be.equal(true); }); }); it('Validate Id Token alternative', () => { - oauthClient.setToken(expectedOpenIDToken); + oauthClient.setToken(mockToken); oauthClient.validateIdToken() .then((response) => { - expect(response).to.be.equal(expectedOpenIDToken); + expect(response).to.be.equal(true); }); }); }); diff --git a/test/mocks/jwkResponse.json b/test/mocks/jwkResponse.json index be557039..b01451f9 100644 --- a/test/mocks/jwkResponse.json +++ b/test/mocks/jwkResponse.json @@ -1,3 +1,3 @@ { - "body":"{\"keys\": [{\"kty\":\"sample_value_kty\",\"e\":\"sample_value_e\",\"use\":\"sample_value_use\",\"kid\":\"sample_value_kid\",\"alg\":\"sample_value_alg\",\"n\":\"sample_value_n\"}]}" -} \ No newline at end of file + "body":"{\"keys\": [{\"kty\":\"sample_value_kty\",\"e\":\"sample_value_e\",\"use\":\"sample_value_use\",\"kid\":\"r4p5SbL2qaFehFzhj8gI\",\"alg\":\"sample_value_alg\",\"n\":\"sample_value_n\"}]}" +} From 7db272a3c2be79e0aa16d0fa8ae479e33c45d24e Mon Sep 17 00:00:00 2001 From: abisalehalliprasan Date: Wed, 23 Oct 2019 21:15:13 -0700 Subject: [PATCH 10/14] Pointing README Badge to Develop --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea447e01..f4380354 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![SDK Banner](views/SDK.png)][ss1] -[![Build Status](https://travis-ci.org/intuit/oauth-jsclient.svg?branch=master)](https://travis-ci.org/intuit/oauth-jsclient) +[![Build Status](https://travis-ci.org/intuit/oauth-jsclient.svg?branch=develop)](https://travis-ci.org/intuit/oauth-jsclient?branch=develop) [![NPM Package Version](https://img.shields.io/npm/v/intuit-oauth.svg?style=flat-square)](https://www.npmjs.com/package/intuit-oauth) [![Coverage Status](https://coveralls.io/repos/github/intuit/oauth-jsclient/badge.svg)](https://coveralls.io/github/intuit/oauth-jsclient) [![Known Vulnerabilities](https://snyk.io/test/github/intuit/oauth-jsclient/badge.svg)](https://snyk.io/test/github/intuit/oauth-jsclient) From 03d89db1ce75809f3f2b32582920486967165aa9 Mon Sep 17 00:00:00 2001 From: abisalehalliprasan Date: Wed, 23 Oct 2019 21:18:31 -0700 Subject: [PATCH 11/14] Pointing README Badge to Develop --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f4380354..77fa7a05 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build Status](https://travis-ci.org/intuit/oauth-jsclient.svg?branch=develop)](https://travis-ci.org/intuit/oauth-jsclient?branch=develop) [![NPM Package Version](https://img.shields.io/npm/v/intuit-oauth.svg?style=flat-square)](https://www.npmjs.com/package/intuit-oauth) -[![Coverage Status](https://coveralls.io/repos/github/intuit/oauth-jsclient/badge.svg)](https://coveralls.io/github/intuit/oauth-jsclient) +[![Coverage Status](https://coveralls.io/repos/github/intuit/oauth-jsclient/badge.svg)](https://coveralls.io/github/intuit/oauth-jsclient?branch=develop) [![Known Vulnerabilities](https://snyk.io/test/github/intuit/oauth-jsclient/badge.svg)](https://snyk.io/test/github/intuit/oauth-jsclient) From f84fb3f78d17a1a1675442a2f3d3116cea746d60 Mon Sep 17 00:00:00 2001 From: abisalehalliprasan Date: Thu, 31 Oct 2019 16:30:06 -0700 Subject: [PATCH 12/14] Update Develop Coverage Badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 77fa7a05..2f983f62 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build Status](https://travis-ci.org/intuit/oauth-jsclient.svg?branch=develop)](https://travis-ci.org/intuit/oauth-jsclient?branch=develop) [![NPM Package Version](https://img.shields.io/npm/v/intuit-oauth.svg?style=flat-square)](https://www.npmjs.com/package/intuit-oauth) -[![Coverage Status](https://coveralls.io/repos/github/intuit/oauth-jsclient/badge.svg)](https://coveralls.io/github/intuit/oauth-jsclient?branch=develop) +[![Coverage Status](https://coveralls.io/repos/github/intuit/oauth-jsclient/badge.svg?branch=develop)](https://coveralls.io/github/intuit/oauth-jsclient?branch=develop) [![Known Vulnerabilities](https://snyk.io/test/github/intuit/oauth-jsclient/badge.svg)](https://snyk.io/test/github/intuit/oauth-jsclient) From c99f31283268653eedb63438da809fa0ddf66cc2 Mon Sep 17 00:00:00 2001 From: abisalehalliprasan Date: Thu, 2 Jan 2020 12:56:33 -0800 Subject: [PATCH 13/14] README.md corrections --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2f983f62..03fd2adb 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ The available scopes include : OpenID Scopes : -* `openid` - for openID assertion include `OAuthClient.scopes.Openid` +* `openid` - for openID assertion include `OAuthClient.scopes.OpenId` * `profile` - for profile assertion include `OAuthClient.scopes.Profile` * `email` - for email assertion include `OAuthClient.scopes.Email` * `phone` - for phone assertion include `OAuthClient.scopes.Phone` @@ -197,7 +197,7 @@ Access tokens are valid for 3600 seconds (one hour), after which time you need t oauthClient.refresh() .then(function(authResponse) { - console.log('Tokens refreshed : ' + JSON.stringify(authResponse.json())); + console.log('Tokens refreshed : ' + JSON.stringify(authResponse.getJson())); }) .catch(function(e) { console.error("The error message is :"+e.originalMessage); @@ -214,7 +214,7 @@ You can call the below helper method to refresh tokens by explictly passing the oauthClient.refreshUsingToken('') .then(function(authResponse) { - console.log('Tokens refreshed : ' + JSON.stringify(authResponse.json())); + console.log('Tokens refreshed : ' + JSON.stringify(authResponse.getJson())); }) .catch(function(e) { console.error("The error message is :"+e.originalMessage); @@ -231,7 +231,7 @@ When you no longer need the access_token, you could use the below helper method oauthClient.revoke() .then(function(authResponse) { - console.log('Tokens revoked : ' + JSON.stringify(authResponse.json())); + console.log('Tokens revoked : ' + JSON.stringify(authResponse.getJson())); }) .catch(function(e) { console.error("The error message is :"+e.originalMessage); @@ -244,7 +244,7 @@ Alternatively you can also pass `access_token` or `refresh_token` to this helper oauthClient.revoke(params) .then(function(authResponse) { - console.log('Tokens revoked : ' + JSON.stringify(authResponse.json())); + console.log('Tokens revoked : ' + JSON.stringify(authResponse.getJson())); }) .catch(function(e) { console.error("The error message is :"+e.originalMessage); From 554da2af91db3532f7e3e9e91457f7a8cf30fb0b Mon Sep 17 00:00:00 2001 From: abisalehalliprasan Date: Thu, 2 Jan 2020 13:20:52 -0800 Subject: [PATCH 14/14] Version Bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 86bee76d..0fb396c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "intuit-oauth", - "version": "2.0.0", + "version": "2.0.1", "description": "Intuit Node.js client for OAuth2.0 and OpenIDConnect", "main": "./src/OAuthClient.js", "scripts": {