Stephen Huey
Stephen Huey

Reputation: 175

Correct URL for OAuth 2 at Quickbooks Online API?

I'd like some help confirming which URLs to use. Quickbooks Online no longer supports OAuth 1 for new accounts and OAuth 2 documentation seems a bit disorganized and confusing. To top it all off, in the past few days I've seen a lot of vague errors from the API and it seems that there was some scheduled maintenance but even though all systems are operational I'm still seeing a message saying "We are temporarily unavailable due to scheduled maintenance."

I've been trying to test the initial step by just pasting a URL into a browser to get an authorization code. Here is my URL verbatim except for a fake client_id and a fake ngrok subdomain:

https://sandbox-quickbooks.api.intuit.com/connect/oauth2?client_id=aaaaaaaaa9999999&response_type=code&scope=com.intuit.quickbooks.accounting&redirect_uri=https://8888888888bbbbbbbb.ngrok.io/quickbooks/start&state=ABC123987XYZab983111

The response currently gives me a pretty yellow post-it note with "We'll be back soon" on it. I know that seems obvious but the Intuit status page shows green on everything. In the event that it really is down, it'd still be helpful if someone can confirm that this is the correct URL to use because I noticed that neither one of the "discovery" documents has this URL but after banging my head against a wall a few days ago I realized the discovery documents could be incorrect so I switched to trying the sandbox URL.

Is that correct or is the base URL supposed to be something else such as

https://appcenter.intuit.com/connect/oauth2

https://oauth.intuit.com/oauth/v1/get_request_token

even in dev mode?

I'm very surprised that there is not a detailed language-agnostic REST client step-by-step example for OAuth2 with the Quickbooks Online API. Someone commented that Intuit must feel that showing how to generate the signature is too complex and everyone should just use an SDK, but none of the SDKs are an option for me.

Thanks for any help!

Upvotes: 3

Views: 1236

Answers (1)

CarlsBad505
CarlsBad505

Reputation: 148

The correct base is https://appcenter.intuit.com/connect/oauth2. All your params look correct too, but you might be running into a encryption problem if you're trying to serve those params in the url like that. From the documentation here: https://developer.intuit.com/docs/0100_quickbooks_online/0100_essentials/000500_authentication_and_authorization/connect_from_within_your_app, it says you need to url encode those params.

Not sure what language / environment you're using, but in RoR, just place the params in a hash like such:

params = {
   client_id: 'aaaaaaaaa9999999',
   key: 'value',
   key: 'value'
}

Then url encode like such:

query = URI.encode_www_form(params)

Finally, toss it into the body of your request before sending it. After sending it, expect to receive an authorization code as part of the query params in the response, which you'll use to post back over again to receive your token and refresh token. Hope this helps!

Upvotes: 5

Related Questions