Skip to content

Commit

Permalink
Merge pull request #168 from intuit/release-4.1.2
Browse files Browse the repository at this point in the history
Release 4.1.2
  • Loading branch information
rajeshgupta723 committed Mar 28, 2024
2 parents ddb2b56 + 961be29 commit 7ea0965
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions README.md
Expand Up @@ -163,7 +163,7 @@ const parseRedirect = req.url;
oauthClient
.createToken(parseRedirect)
.then(function (authResponse) {
console.log('The Token is ' + JSON.stringify(authResponse.getJson()));
console.log('The Token is ' + JSON.stringify(authResponse.json));
})
.catch(function (e) {
console.error('The error message is :' + e.originalMessage);
Expand Down Expand Up @@ -215,7 +215,7 @@ previous refresh tokens expire 24 hours after you receive a new one.
oauthClient
.refresh()
.then(function (authResponse) {
console.log('Tokens refreshed : ' + JSON.stringify(authResponse.getJson()));
console.log('Tokens refreshed : ' + JSON.stringify(authResponse.json));
})
.catch(function (e) {
console.error('The error message is :' + e.originalMessage);
Expand All @@ -232,7 +232,7 @@ You can call the below helper method to refresh tokens by explictly passing the
oauthClient
.refreshUsingToken('<Enter the refresh token>')
.then(function (authResponse) {
console.log('Tokens refreshed : ' + JSON.stringify(authResponse.getJson()));
console.log('Tokens refreshed : ' + JSON.stringify(authResponse.json));
})
.catch(function (e) {
console.error('The error message is :' + e.originalMessage);
Expand All @@ -249,7 +249,7 @@ tokens.
oauthClient
.revoke()
.then(function (authResponse) {
console.log('Tokens revoked : ' + JSON.stringify(authResponse.getJson()));
console.log('Tokens revoked : ' + JSON.stringify(authResponse.json));
})
.catch(function (e) {
console.error('The error message is :' + e.originalMessage);
Expand All @@ -265,7 +265,7 @@ how to retrieve the `token` object
oauthClient
.revoke(params)
.then(function (authResponse) {
console.log('Tokens revoked : ' + JSON.stringify(authResponse.getJson()));
console.log('Tokens revoked : ' + JSON.stringify(authResponse.json));
})
.catch(function (e) {
console.error('The error message is :' + e.originalMessage);
Expand Down Expand Up @@ -509,10 +509,10 @@ You can use the below helper methods to make full use of the Auth Response Objec

```javascript
oauthClient.createToken(parseRedirect).then(function (authResponse) {
console.log('The Token in JSON is ' + JSON.stringify(authResponse.getJson()));
console.log('The Token in JSON is ' + JSON.stringify(authResponse.json));
let status = authResponse.status();
let body = authResponse.text();
let jsonResponse = authResponse.getJson();
let jsonResponse = authResponse.json;
let intuit_tid = authResponse.get_intuit_tid();
});
```
Expand Down
4 changes: 2 additions & 2 deletions sample/app.js
Expand Up @@ -95,7 +95,7 @@ app.get('/refreshAccessToken', function (req, res) {
oauthClient
.refresh()
.then(function (authResponse) {
console.log(`The Refresh Token is ${JSON.stringify(authResponse.json)}`);
console.log(`\n The Refresh Token is ${JSON.stringify(authResponse.json)}`);
oauth2_token_json = JSON.stringify(authResponse.json, null, 2);
res.send(oauth2_token_json);
})
Expand All @@ -118,7 +118,7 @@ app.get('/getCompanyInfo', function (req, res) {
oauthClient
.makeApiCall({ url: `${url}v3/company/${companyID}/companyinfo/${companyID}` })
.then(function (authResponse) {
console.log(`The response for API call is :${JSON.stringify(authResponse.json)}`);
console.log(`\n The response for API call is :${JSON.stringify(authResponse.json)}`);
res.send(authResponse.json);
})
.catch(function (e) {
Expand Down
12 changes: 6 additions & 6 deletions src/OAuthClient.js
Expand Up @@ -182,7 +182,7 @@ OAuthClient.prototype.createToken = function createToken(uri) {
resolve(this.getTokenRequest(request));
})
.then((res) => {
const { response, ...authResponse } = res.json ? res : null;
const authResponse = res.json ? res : null;
const json = (authResponse && authResponse.json) || res;
this.token.setToken(json);
this.log('info', 'Create Token response is : ', JSON.stringify(authResponse.json, null, 2));
Expand Down Expand Up @@ -223,7 +223,7 @@ OAuthClient.prototype.refresh = function refresh() {
resolve(this.getTokenRequest(request));
})
.then((res) => {
const { request, ...authResponse } = res.json ? res : null;
const authResponse = res.json ? res : null;
const json = (authResponse && authResponse.json) || res;
this.token.setToken(json);
this.log('info', 'Refresh Token () response is : ', JSON.stringify(authResponse.json, null, 2));
Expand Down Expand Up @@ -265,7 +265,7 @@ OAuthClient.prototype.refreshUsingToken = function refreshUsingToken(refresh_tok
resolve(this.getTokenRequest(request));
})
.then((res) => {
const { request, ...authResponse } = res.json ? res : null;
const authResponse = res.json ? res : null;
const json = (authResponse && authResponse.json) || res;
this.token.setToken(json);
this.log(
Expand Down Expand Up @@ -316,7 +316,7 @@ OAuthClient.prototype.revoke = function revoke(params) {
resolve(this.getTokenRequest(request));
})
.then((res) => {
const { request, ...authResponse } = res.json ? res : null;
const authResponse = res.json ? res : null;
this.token.clearToken();
this.log('info', 'Revoke Token () response is : ', JSON.stringify(authResponse.json, null, 2));
return authResponse;
Expand Down Expand Up @@ -350,7 +350,7 @@ OAuthClient.prototype.getUserInfo = function getUserInfo() {
resolve(this.getTokenRequest(request));
})
.then((res) => {
const { request, ...authResponse } = res.json ? res : null;
const authResponse = res.json ? res : null;
this.log(
'info',
'The Get User Info () response is : ',
Expand Down Expand Up @@ -403,7 +403,7 @@ OAuthClient.prototype.makeApiCall = function makeApiCall(params) {
resolve(this.getTokenRequest(request));
})
.then((res) => {
const { request, ...authResponse } = res.json ? res : null;
const authResponse = res.json ? res : null;
this.log('info', 'The makeAPICall () response is : ', JSON.stringify(authResponse.json, null, 2));
return authResponse;
})
Expand Down

0 comments on commit 7ea0965

Please sign in to comment.