This is a quick OAuth2.0 incorporated demo that runs using JavaScript, Node.js and Express with the
node-quickbooks SDK
This sample app is meant to showcase an example of how to integrate your app with the Intuit Developer Platform. It showcases the following:
- Authorize into the app via OAuth2.0 ( Ref to OAuth2.0 for server side web-apps for more information )
- Create a sample customer
- Receive webhook notifications
- Write the notifications to a CSV file
$ git clone https://github.com/IntuitDeveloper/SampleApp-WebhookNotifications-nodejs
$ cd SampleApp-WebhookNotifications-nodejs
$ npm install
Copy the contents from sample-config.json
to config.json
:
$ cp sample-confog.json config.json
Edit the config.json
file to add your:
- clientId: You can find your
clientId
from theKeys
tab under yourApp
listed on the developer portal - clientSecret: You can find your
clientSecret
from theKeys
tab under yourApp
- redirectUri: The
redirectUri
for your app ( OAuth2.0 ) - webhookUri: You can find your
webhookUri
from theWebhooks
tab under yourApp
- webhooksVerifier: copy the
show token
from theWebhooks
tab under yourApp
In the Developer Portal, ensure the redirect URI in your config.json
file has been entered in your app configuration. By default, the URL is set to the following for this demo:
Some properties of note:
Property | Description |
---|---|
redirectUri |
This is the OAuth 2.0 redirect URL, this will end in /call and be something like http://localhost:3000/callback or https://755c8b38.ngrok.io/callback . This needs to be configured in your app in the Developer Portal(https://developer.intuit.com) |
webhookUri |
This is the webhook URL which ends in /webhook and can be something like https://yourdomain.com/webhook or https://755c8b38.ngrok.io/hook . |
Webhooks requires your enpoint to be exposed over the internet. The easiest way to do that while you are still developing your code locally is to use ngrok.
Here are the steps to configure ngrok
- Download and install ngrok
- Expose your localhost by running "ngrok http 3000" on the command line.
- You will then get a forwarding url that looks something like this: Forwarding https://755c8b38.ngrok.io -> localhost:3000
This will expose localhost:3000 to the Internet. Your endpoint url will now be https://755c8b38.ngrok.io/webhooks Copy this url and use it for setting up webhooks on Intuit Developer Portal for your app.
$ npm start
$ ngrok http 3000
Go to the URL (you must start ngrok if using it):
https://755c8b38.ngrok.io/
Then click the button to authorize the demo app and view the access token.
Events are logged to the Node.js console.