Talking about my Salesforce.com and MuleSoft experience

Edgar Moran

Software Engineer, passionate for tech stuff video and photography, Salesforce and Mulesoft developer


Our Newsletter

Subscribe to get new post notifications.

* indicates required




Authorization process for QuickBooks Online using Mule (no connector)

Edgar MoranEdgar Moran

In my current company we get a lot of integration requirements, one of them was to integrate Salesforce with QuickBooks Desktop, in the end we achieve that and I tough that the integration with Quickbooks Online version would be super easy as already there's a connector listed in Exchange.

I didn't understand at the beginning that connector community are not supported by Mulesoft, so this means if you run in technical issues Mulesfot will no help you to solve the issue and they will suggest to check in the forums / internet for information.

The connector for QuickBooks online has a GitHub repository listed here but seems to be pretty out of the date, so far last change in the repository was a couple of year ago (no good for devs).

So instead of really used the connector I had to use plan B (HTTP Requests to the API).

Here the steps I did in order to authorize the my calls getting the authorization code, access code and refresh token. This is only a way to get the info, and maybe is not the best way so far, I will be glad if someone shares an example using the connector.

  1. Create a flow with an HTTP Inbound connector
  2. Place a HTTP Static resource Handler connector (resource base:${app.home}/web Default file: ${env}.staticForm.html)
  3. Under src/main/app create a new folder named web
  4. Create a new HTML file called test.staticForm.html and be sure is saved inside the web folder we created in the previous step
          <h2><a href="https://appcenter.intuit.com/connect/oauth2?client_id=YOUR-CLIENT-ID&redirect_uri=REDIRECT-URL&response_type=code&scope=com.intuit.quickbooks.accounting&state=gcv">Clic to Authenticate</a></h2>

This basically will allow you to redirect directly to the authorization page of your application, I'm using this process because using a HTTP Request connector with the parameters shows the page but always I got the "An error has occurred" trying to login.

  1. Once we clic in the link we should see an screen like this:


  1. The Redirect URL should point to a new flow with HTTP connector using the /callback path. Once we click on Authorize button, the page will redirect to your callback flow


Then you be able to get the authorization code with #message.inboundProperties.'http.query.params'.code]

  1. We need to have a different flow to generate the authorization code and refresh token. We need to set a Data Weave component like this (p(emoran.redirectURI)) is getting the redirect URI from properties file.
%dw 1.0
%output application/java
  1. Then we need to do the HTTP POST Request to the QuickBooks API, it should look like:


We need to include Authorization header and it is built like this

Basic #[new String(org.apache.commons.codec.binary.Base64.encodeBase64(("${emoran.clientId}:${emoran.secret}").getBytes()))]

  1. We call the refresh token API
  2. Data Weave looks like
%dw 1.0
%output application/java


  1. The reponse is a JSON object, so we need to convert it in a JAVA object
  2. Finally I'm storing the current object in a object store like this


  1. Next and last, we should have a refresh token poller, this flow will refresh the access code with the refresh token every 'n' minutes.


Basically I get the object store quickbooks payload, then I call the refresh token again

  1. If the refreshObject (object with access code and refresh token) key already exist, first I delete it and then I store the most recent result.

  2. And finally we should have a get Object variables:


Basically we get the refreshObject key and we can use the access code to make our api calls, maybe just stored as a flow Variable or directly from the object store.

That would be great to have an up of the date quickbooks connector but for now I guess I will use this strategy.

Hope this will help others and if someone has already a sample using the current connector even better.

Edgar Moran

Edgar Moran

Software Engineer, passionate for tech stuff video and photography, Salesforce and Mulesoft developer