Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 4.0.0 #114

Merged
merged 7 commits into from
May 27, 2021
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
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
language: node_js

node_js:
- 9
- 8
- 10
- 11
- 12
- 14

before_script:
- npm install
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog


## [4.0.0](https://github.com/intuit/oauth-jsclient/tree/4.0.0)
#### Breaking Changes
- Minimum Node Version >= 10
#### Features
- Supports Minimum Node version 10 and newer ( not backward compatible )
- Moved lower node versions ( node 8,9, node 7, node 6 to 3.x.x. , 2.x.x and 1.x.x release respectively )
- node version 8,9 and higher refer to 3.x.x
- node version 7 and higher refer to 2.x.x
- node version 6 and higher refer to 1.x.x
#### Issues Fixed
- [Adding Transport Override for PDF use case](https://github.com/intuit/oauth-jsclient/pull/98)

#### References
- [PDF Transport](https://github.com/intuit/oauth-jsclient/issues/97)


## [3.0.2](https://github.com/intuit/oauth-jsclient/tree/3.0.2)
#### Features
- [Added support for passing custom authorize URL's](https://github.com/intuit/oauth-jsclient/pull/92)
Expand Down
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ implementations which conforms to the specifications.

# Requirements

The Node.js client library is tested against the `Node 8 LTS` and newer versions.
The Node.js client library is tested against the `Node 10` and newer versions.

To use in node 6, please use
[intuit-oauth@1.x.](https://github.com/intuit/oauth-jsclient/tree/1.5.0)
| Version | Node support |
|----------------------------------------------------------------------------------|-----------------------------------|
| [intuit-oauth@1.x.x](https://github.com/intuit/oauth-jsclient/tree/1.5.0) | Node 6.x or higher |
| [intuit-oauth@2.x.x](https://github.com/intuit/oauth-jsclient/tree/2.0.0) | Node 7.x or higher |
| [intuit-oauth@3.x.x](https://github.com/intuit/oauth-jsclient/tree/3.0.2) | Node 8.x or Node 9.x and higher |

To use in node 7, please use
[intuit-oauth@2.x.](https://github.com/intuit/oauth-jsclient/tree/2.0.0). Older node versions are
not supported.
**Note**: Older node versions are not supported.

# Installation

Expand Down Expand Up @@ -440,6 +441,13 @@ oauthClient
The client validates the ID Token and returns boolean `true` if validates successfully else it would
throw an exception.

#### Support for PDF format
In order to save the PDF generated from the APIs properly, the correct transport type should be passed into the `makeAPI()`.Below is an example of the same:
```
.makeApiCall({ url: `${url}v3/company/${companyID}/invoice/${invoiceNumber}/pdf?minorversion=59` , headers:{'Content-Type': 'application/pdf','Accept':'application/pdf'}, transport: popsicle.createTransport({type: 'buffer'})})
```
The response is an actual buffer( binary BLOB) which could then be saved to the file.

### Auth-Response

The response provided by the client is a wrapped response of the below items which is what we call
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intuit-oauth",
"version": "3.0.2",
"version": "4.0.0",
"description": "Intuit Node.js client for OAuth2.0 and OpenIDConnect",
"main": "./src/OAuthClient.js",
"scripts": {
Expand Down Expand Up @@ -51,7 +51,7 @@
]
},
"engines": {
"node": ">=8.17.0"
"node": ">=10"
},
"repository": {
"type": "git",
Expand Down
6 changes: 4 additions & 2 deletions src/OAuthClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ OAuthClient.prototype.getUserInfo = function getUserInfo() {
OAuthClient.prototype.makeApiCall = function makeApiCall(params) {
return new Promise((resolve) => {
params = params || {};
const transport = params.transport ? params.transport : popsicle.createTransport({ type: "text" });

const headers =
params.headers && typeof params.headers === 'object'
Expand All @@ -382,21 +383,22 @@ OAuthClient.prototype.makeApiCall = function makeApiCall(params) {
Accept: AuthResponse._jsonContentType,
'User-Agent': OAuthClient.user_agent,
},
params.headers,
params.headers
)
: Object.assign(
{},
{
Authorization: `Bearer ${this.getToken().access_token}`,
Accept: AuthResponse._jsonContentType,
'User-Agent': OAuthClient.user_agent,
},
}
);

const request = {
url: params.url,
method: params.method || 'GET',
headers,
transport,
};

params.body && (request.body = params.body);
Expand Down