-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec3f14a
commit 3685c8f
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
@@ -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 : | ||
|
@@ -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 | ||
|