Access the QuickBooks Online API with OAuth2
OAuth2 required for new Intuit Developer Accounts
Starting July 17th, 2017 all new Intuit Developer accounts will need to use OAuth2 for API access. Here is how to use the QboApi gem and OAuth2.
Choosing an OAuth2 gem or not
I really won't bother trying to re-invent the wheel by rolling your own OAuth2 code. That said, the OAuth2 2-legged process is simpler than the 3-legged OAuth 1a process and if you do want to roll your own OAuth2 code take a look at Intuit's Python example for a good starting point.
As for me, I'll choose to leverage the Rack-OAuth2 gem as I like its ability to directly set endpoints.
Spinning up an OAuth2 example
- Clone the
qbo_api
gem, switch into the new directory, andbundle
-
Create a .env file with the
client_id
andclient_secret
provided within the App settings page. See Fig. 2. - Set the OAuth2 callback or redirect URI to http://localhost:9393/oauth2-redirect
- Start up the example app
- Goto
https://localhost:9393/oauth2
- Click on the 'Connect To QuickBooks' button, Sign in, and click on Authorize.
- The response.
- The response code.
- Click on Click here to make an API call.
$ git clone git://github.com/minimul/qbo_api && cd qbo_api $ bundle
export QBO_API_CLIENT_ID= export QBO_API_CLIENT_SECRET=
This section is at the 2:16 mark.
$ shotgun example/app.rb
This section is at the 5:19 mark.
This section is at the 8:51 mark.
- Pushed on 07/31/2017 by Christian
- QuickBooks Integration Consulting