Skip to content

Commit

Permalink
Release Candidate 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
abisalehalliprasan committed Oct 18, 2019
1 parent ec3f14a commit 3685c8f
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The OAuth2 Nodejs Client library is meant to work with Intuit's [OAuth2.0](https
- [Set the Token :](#set-the-token-)
- [Migrate OAuth1.0 Tokens to OAuth2.0](#migrate-oauth10-tokens-to-oauth20)
- [Validate ID Token](#validate-id-token)
- [Make API call](#make-api-call)
- [Auth-Response](#auth-response)
- [Error Logging](#error-logging)
- [FAQ](#faq)
Expand All @@ -47,6 +48,8 @@ The OAuth2 Nodejs Client library is meant to work with Intuit's [OAuth2.0](https

The Node.js client library is tested against the `Node` >= `7.0.0`

To use in node 6, please use [[email protected].](https://github.com/intuit/oauth-jsclient/tree/1.5.0) Older node versions are unsupported.

# Installation

Follow the instructions below to use the library :
Expand Down Expand Up @@ -370,6 +373,52 @@ You can validate the ID token obtained from `Intuit Authorization Server` as sho
The client validates the ID Token and returns boolean `true` if validates successfully else it would throw an exception.
### Make API Call
You can make API call using the token generated from the client as shown below :
```javascript
// Body sample from API explorer examples
const body = {
TrackQtyOnHand: true,
Name: "Garden Supplies",
QtyOnHand: 10,
InvStartDate: "2015-01-01",
Type: "Inventory",
IncomeAccountRef: {
name: "Sales of Product Income",
value: "79"
},
AssetAccountRef: {
name: "Inventory Asset",
value: "81"
},
ExpenseAccountRef: {
name: "Cost of Goods Sold",
value: "80"
}
};
oauthClient.makeApiCall({
url: 'https://sandbox-quickbooks.api.intuit.com/v3/company/1234/item',
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
}).then(function(response){
console.log('The API response is : ' + response);
})
.catch(function(e) {
console.log('The error is '+ JSON.stringify(e));
});
```
The client validates the ID Token and returns boolean `true` if validates successfully else it would throw an exception.
### Auth-Response
Expand Down

0 comments on commit 3685c8f

Please sign in to comment.