Skip to content

Commit

Permalink
Fixed issue: #171
Browse files Browse the repository at this point in the history
  • Loading branch information
rgupta24723 committed May 6, 2024
1 parent 7ea0965 commit e88cda3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 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.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
7 changes: 4 additions & 3 deletions src/OAuthClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,9 @@ 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));
if (res) return true;
const response = res.json ? res : null;
this.log('info', 'The validateIdToken () response is :', JSON.stringify(response.json, null, 2));
if (response) return true;
return false;
})
.catch((e) => {
Expand All @@ -476,7 +477,7 @@ OAuthClient.prototype.getKeyFromJWKsURI = function getKeyFromJWKsURI(id_token, k
.then((response) => {
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 responseBody = JSON.parse(response.json);
const key = responseBody.keys.find((el) => el.kid === kid);
const cert = this.getPublicKey(key.n, key.e);

Expand Down

0 comments on commit e88cda3

Please sign in to comment.