Skip to content

Commit 961be29

Browse files
committed
Fix for issue#167, updated documentation, and removed unused var
1 parent 6ad9b49 commit 961be29

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ const parseRedirect = req.url;
163163
oauthClient
164164
.createToken(parseRedirect)
165165
.then(function (authResponse) {
166-
console.log('The Token is ' + JSON.stringify(authResponse.getJson()));
166+
console.log('The Token is ' + JSON.stringify(authResponse.json));
167167
})
168168
.catch(function (e) {
169169
console.error('The error message is :' + e.originalMessage);
@@ -215,7 +215,7 @@ previous refresh tokens expire 24 hours after you receive a new one.
215215
oauthClient
216216
.refresh()
217217
.then(function (authResponse) {
218-
console.log('Tokens refreshed : ' + JSON.stringify(authResponse.getJson()));
218+
console.log('Tokens refreshed : ' + JSON.stringify(authResponse.json));
219219
})
220220
.catch(function (e) {
221221
console.error('The error message is :' + e.originalMessage);
@@ -232,7 +232,7 @@ You can call the below helper method to refresh tokens by explictly passing the
232232
oauthClient
233233
.refreshUsingToken('<Enter the refresh token>')
234234
.then(function (authResponse) {
235-
console.log('Tokens refreshed : ' + JSON.stringify(authResponse.getJson()));
235+
console.log('Tokens refreshed : ' + JSON.stringify(authResponse.json));
236236
})
237237
.catch(function (e) {
238238
console.error('The error message is :' + e.originalMessage);
@@ -249,7 +249,7 @@ tokens.
249249
oauthClient
250250
.revoke()
251251
.then(function (authResponse) {
252-
console.log('Tokens revoked : ' + JSON.stringify(authResponse.getJson()));
252+
console.log('Tokens revoked : ' + JSON.stringify(authResponse.json));
253253
})
254254
.catch(function (e) {
255255
console.error('The error message is :' + e.originalMessage);
@@ -265,7 +265,7 @@ how to retrieve the `token` object
265265
oauthClient
266266
.revoke(params)
267267
.then(function (authResponse) {
268-
console.log('Tokens revoked : ' + JSON.stringify(authResponse.getJson()));
268+
console.log('Tokens revoked : ' + JSON.stringify(authResponse.json));
269269
})
270270
.catch(function (e) {
271271
console.error('The error message is :' + e.originalMessage);
@@ -509,10 +509,10 @@ You can use the below helper methods to make full use of the Auth Response Objec
509509

510510
```javascript
511511
oauthClient.createToken(parseRedirect).then(function (authResponse) {
512-
console.log('The Token in JSON is ' + JSON.stringify(authResponse.getJson()));
512+
console.log('The Token in JSON is ' + JSON.stringify(authResponse.json));
513513
let status = authResponse.status();
514514
let body = authResponse.text();
515-
let jsonResponse = authResponse.getJson();
515+
let jsonResponse = authResponse.json;
516516
let intuit_tid = authResponse.get_intuit_tid();
517517
});
518518
```

src/OAuthClient.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ OAuthClient.prototype.createToken = function createToken(uri) {
182182
resolve(this.getTokenRequest(request));
183183
})
184184
.then((res) => {
185-
const { response, ...authResponse } = res.json ? res : null;
185+
const authResponse = res.json ? res : null;
186186
const json = (authResponse && authResponse.json) || res;
187187
this.token.setToken(json);
188188
this.log('info', 'Create Token response is : ', JSON.stringify(authResponse.json, null, 2));
@@ -223,7 +223,7 @@ OAuthClient.prototype.refresh = function refresh() {
223223
resolve(this.getTokenRequest(request));
224224
})
225225
.then((res) => {
226-
const { request, ...authResponse } = res.json ? res : null;
226+
const authResponse = res.json ? res : null;
227227
const json = (authResponse && authResponse.json) || res;
228228
this.token.setToken(json);
229229
this.log('info', 'Refresh Token () response is : ', JSON.stringify(authResponse.json, null, 2));
@@ -265,7 +265,7 @@ OAuthClient.prototype.refreshUsingToken = function refreshUsingToken(refresh_tok
265265
resolve(this.getTokenRequest(request));
266266
})
267267
.then((res) => {
268-
const { request, ...authResponse } = res.json ? res : null;
268+
const authResponse = res.json ? res : null;
269269
const json = (authResponse && authResponse.json) || res;
270270
this.token.setToken(json);
271271
this.log(
@@ -316,7 +316,7 @@ OAuthClient.prototype.revoke = function revoke(params) {
316316
resolve(this.getTokenRequest(request));
317317
})
318318
.then((res) => {
319-
const { request, ...authResponse } = res.json ? res : null;
319+
const authResponse = res.json ? res : null;
320320
this.token.clearToken();
321321
this.log('info', 'Revoke Token () response is : ', JSON.stringify(authResponse.json, null, 2));
322322
return authResponse;
@@ -350,7 +350,7 @@ OAuthClient.prototype.getUserInfo = function getUserInfo() {
350350
resolve(this.getTokenRequest(request));
351351
})
352352
.then((res) => {
353-
const { request, ...authResponse } = res.json ? res : null;
353+
const authResponse = res.json ? res : null;
354354
this.log(
355355
'info',
356356
'The Get User Info () response is : ',
@@ -403,7 +403,7 @@ OAuthClient.prototype.makeApiCall = function makeApiCall(params) {
403403
resolve(this.getTokenRequest(request));
404404
})
405405
.then((res) => {
406-
const { request, ...authResponse } = res.json ? res : null;
406+
const authResponse = res.json ? res : null;
407407
this.log('info', 'The makeAPICall () response is : ', JSON.stringify(authResponse.json, null, 2));
408408
return authResponse;
409409
})

0 commit comments

Comments
 (0)