Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [4.1.3](https://github.com/intuit/oauth-jsclient/tree/4.1.3)
#### Features
- None
#### Issues Fixed
- [minor fixes OAuthClient.js](https://github.com/intuit/oauth-jsclient/pull/171)

## [4.1.2](https://github.com/intuit/oauth-jsclient/tree/4.1.2)
#### Issues Fixed
- [fixed Error converting authResponse to JSON string](https://github.com/intuit/oauth-jsclient/pull/165)

## [4.1.1](https://github.com/intuit/oauth-jsclient/tree/4.1.1)
#### Features
Expand Down
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.2",
"version": "4.1.3",
"description": "Intuit Node.js client for OAuth2.0 and OpenIDConnect",
"main": "./src/OAuthClient.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion sample/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ app.get('/authUri', urlencodedParser, function (req, res) {
});

const authUri = oauthClient.authorizeUri({
scope: [OAuthClient.scopes.Accounting],
scope: [OAuthClient.scopes.Accounting, OAuthClient.scopes.OpenId, OAuthClient.scopes.Profile, OAuthClient.scopes.Email],
state: 'intuit-test',
});
res.send(authUri);
Expand Down
14 changes: 7 additions & 7 deletions src/OAuthClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ OAuthClient.prototype.createToken = function createToken(uri) {
resolve(this.getTokenRequest(request));
})
.then((res) => {
const authResponse = res.json ? res : null;
const authResponse = res.hasOwnProperty('json')? res : null;
const json = (authResponse && authResponse.json) || res;
this.token.setToken(json);
this.log('info', 'Create Token response is : ', JSON.stringify(authResponse && authResponse.json, null, 2));
this.log('info', 'Create Token response is : ', JSON.stringify(authResponse && authResponse.json, null, 2));
return authResponse;
})
.catch((e) => {
Expand Down Expand Up @@ -223,7 +223,7 @@ OAuthClient.prototype.refresh = function refresh() {
resolve(this.getTokenRequest(request));
})
.then((res) => {
const authResponse = res.json ? res : null;
const authResponse = res.hasOwnProperty('json')? res : null;
const json = (authResponse && authResponse.json) || res;
this.token.setToken(json);
this.log('info', 'Refresh Token () response is : ', JSON.stringify(authResponse && 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 authResponse = res.json ? res : null;
const authResponse = res.hasOwnProperty('json')? res : null;
const json = (authResponse && authResponse.json) || res;
this.token.setToken(json);
this.log(
Expand Down Expand Up @@ -315,7 +315,7 @@ OAuthClient.prototype.revoke = function revoke(params) {
resolve(this.getTokenRequest(request));
})
.then((res) => {
const authResponse = res.json ? res : null;
const authResponse = res.hasOwnProperty('json')? res : null;
this.token.clearToken();
this.log('info', 'Revoke Token () response is : ', JSON.stringify(authResponse && authResponse.json, null, 2));
return authResponse;
Expand Down Expand Up @@ -349,7 +349,7 @@ OAuthClient.prototype.getUserInfo = function getUserInfo() {
resolve(this.getTokenRequest(request));
})
.then((res) => {
const authResponse = res.json ? res : null;
const authResponse = res.hasOwnProperty('json')? res : null;
this.log(
'info',
'The Get User Info () response is : ', JSON.stringify(authResponse && authResponse.json, null, 2),
Expand Down Expand Up @@ -456,7 +456,7 @@ OAuthClient.prototype.validateIdToken = function validateIdToken(params = {}) {
return resolve(this.getKeyFromJWKsURI(id_token, id_token_header.kid, request));
})
.then((res) => {
this.log('info', 'The validateIdToken () response is : ', JSON.stringify(res, null, 2));
this.log('info', 'The validateIdToken () response is :', JSON.stringify(res, null, 2));
if (res) return true;
return false;
})
Expand Down