Skip to content

Commit

Permalink
Merge pull request #160 from intuit/release-4.1.1
Browse files Browse the repository at this point in the history
fix authResponse.json issue
  • Loading branch information
rajeshgupta723 authored Mar 13, 2024
2 parents bdf44cf + 2bd86f2 commit 3698874
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intuit-oauth",
"version": "4.1.0",
"version": "4.1.1",
"description": "Intuit Node.js client for OAuth2.0 and OpenIDConnect",
"main": "./src/OAuthClient.js",
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions sample/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ app.get('/callback', function (req, res) {
oauthClient
.createToken(req.url)
.then(function (authResponse) {
oauth2_token_json = JSON.stringify(authResponse.getJson(), null, 2);
oauth2_token_json = JSON.stringify(authResponse.json, null, 2);
})
.catch(function (e) {
console.error(e);
Expand All @@ -95,8 +95,8 @@ app.get('/refreshAccessToken', function (req, res) {
oauthClient
.refresh()
.then(function (authResponse) {
console.log(`The Refresh Token is ${JSON.stringify(authResponse.getJson())}`);
oauth2_token_json = JSON.stringify(authResponse.getJson(), null, 2);
console.log(`The Refresh Token is ${JSON.stringify(authResponse.json)}`);
oauth2_token_json = JSON.stringify(authResponse.json, null, 2);
res.send(oauth2_token_json);
})
.catch(function (e) {
Expand All @@ -118,8 +118,8 @@ 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)}`);
res.send(JSON.parse(authResponse.text()));
console.log(`The response for API call is :${JSON.stringify(authResponse.json)}`);
res.send(authResponse.json);
})
.catch(function (e) {
console.error(e);
Expand Down
10 changes: 5 additions & 5 deletions src/OAuthClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ OAuthClient.prototype.createToken = function createToken(uri) {
const { response, ...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, null, 2));
this.log('info', 'Create Token response is : ', JSON.stringify(authResponse.json, null, 2));
return authResponse;
})
.catch((e) => {
Expand Down Expand Up @@ -224,9 +224,9 @@ OAuthClient.prototype.refresh = function refresh() {
})
.then((res) => {
const { request, ...authResponse } = res.json ? res : null;
const json = (authResponse && authResponse.getJson()) || res;
const json = (authResponse && authResponse.json) || res;
this.token.setToken(json);
this.log('info', 'Refresh Token () response is : ', JSON.stringify(authResponse, null, 2));
this.log('info', 'Refresh Token () response is : ', JSON.stringify(authResponse.json, null, 2));
return authResponse;
})
.catch((e) => {
Expand Down Expand Up @@ -266,7 +266,7 @@ OAuthClient.prototype.refreshUsingToken = function refreshUsingToken(refresh_tok
})
.then((res) => {
const { request, ...authResponse } = res.json ? res : null;
const json = (authResponse && authResponse.getJson()) || res;
const json = (authResponse && authResponse.json) || res;
this.token.setToken(json);
this.log(
'info',
Expand Down Expand Up @@ -402,7 +402,7 @@ OAuthClient.prototype.makeApiCall = function makeApiCall(params) {
resolve(this.getTokenRequest(request));
})
.then(({ request, ...authResponse }) => {
this.log('info', 'The makeAPICall () response is : ', JSON.stringify(authResponse, null, 2));
this.log('info', 'The makeAPICall () response is : ', JSON.stringify(authResponse.json, null, 2));
return authResponse;
})
.catch((e) => {
Expand Down

0 comments on commit 3698874

Please sign in to comment.