Java Sample App using SDK
Table of Contents
In order to successfully run this sample app you need a few things:
- Java 1.8
- A developer.intuit.com account
- An app on developer.intuit.com and the associated client id and client secret.
First Use Instructions
- Clone the GitHub repo to your computer
- Fill in the
application.propertiesfile values (OAuth2AppClientId, OAuth2AppClientSecret) by copying over from the keys section for your app.
- Use the Oauth playground to generate tokens and ill in the
application.propertiesfile values (accessToken, refreshToken, companyid).
Running the code
Once the sample app code is on your computer, you can do the following steps to run the app:
- cd to the project directory
- Run the command:
./gradlew bootRun(Mac OS) or
- Wait until the terminal output displays the "Started Application in xxx seconds" message.
- Your app should be up now in http://localhost:8080/
The sample app demonstrates the following flows:
QBO CompanyInfo GET API - this flow shows how to make a QBO API Get request using SDK to fetch Company Information.
QBO Create Customer POST API - this flow shows how to make a QBO API Post request using SDK to create a customer.
Handle expired tokens - Both the API calls above demonstrates how to refresh the token when token expires.
Storing the tokens
This app stores all the tokens and user information in the session. For production ready app, tokens should be encrypted and stored in a database.