You can authenticate with QuickBooks using either OAuth 2.0 authentication or OAuth 1.0 authentication. OAuth 2.0 is available for new apps created after July 17, 2017, while OAuth 1.0 is available for apps created before then. See Intuit's documentation about OAuth 2.0 for more details.
For apps created prior to July 2017, QuickBooks authentication also supports Token Based authentication.
You can authenticate with QuickBooks Online to create your own instance of the QuickBooks Online element only through APIs. Once authenticated, you can use the element instance to access the different functionality offered by the QuickBooks Online platform.
use_sandbox
as true
when you authenticate an element instance. Authenticating through API follows a multi-step OAuth 2.0 process that involves:
Use the following API call to request a redirect URL where the user can authenticate with the service provider. Replace {keyOrId}
with the element key, quickbooks
. Note the scope
and authentication.type
parameters that are unique to QuickBooks Online.
curl -X GET /elements/{keyOrId}/oauth/url?apiKey=<api_key>&apiSecret=<api_secret>&callbackUrl=<url>&siteAddress=<url>&scope=com.intuit.quickbooks.accounting&authentication.type=oauth2
Query Parameter | Description |
---|---|
apiKey | The API key or client ID obtained from registering your app with the provider. This is the Client ID that you recorded in API Provider Setup section. |
apiSecret | The client secret obtained from registering your app with the API provider. This is the Client Secret that you recorded in API Provider Setup section. |
callbackUrl | The URL that the API provider returns a user to after they authorize access. This is the Redirect URI that you recorded in API Provider Setup section |
scope | The scope provided is required to access data in QuickBooks online. |
authentication.type | Identifies that you are authenticating with OAuth 2.0. |
curl -X GET \
'https://api.cloud-elements.com/elements/api-v2/elements/quickbooks/oauth/url?apiKey=fake_api_key&apiSecret=fake_api_secret&callbackUrl=https://www.mycoolapp.com/auth&scope=com.intuit.quickbooks.accounting&authentication.type=oauth2' \
Use the oauthUrl
in the response to allow users to authenticate with the vendor.
{
"oauthUrl": "https://appcenter.intuit.com/connect/oauth2?scope=com.intuit.quickbooks.accounting&response_type=code&redirect_uri=https%3A%2F%2Fhttpbin.org%2Fget&state=quickbooks&client_id=Q0rGWmlUp1UFMHPqaZ8nwjyiA5linuQ23RmjsMPHL658osSGlk",
"element": "quickbooks"
}
Provide the response from the previous step to the users. After they authenticate, QuickBooks Online provides the following information in the response:
{
"code": "Q011xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"realmId": "1231xxxxxxxxxxxxx",
"state": "quickbooks"
}
Response Parameter | Description |
---|---|
code | The authorization grant code returned from the API provider in an OAuth 2.0 authentication workflow. Cloud Elements uses the code to retrieve the OAuth access and refresh tokens from the endpoint. |
realmID | An identifier unique to QuickBooks that identifies the company that the authenticated instance is connected to. |
state | A customizable identifier, typically the element key (quickbooks ) . |
error
instead of the code
parameter. In this case, your application can handle the error gracefully.
Use the /instances
endpoint to authenticate with QuickBooks Online and create an element instance. If you are configuring events, see the Events section.
To authenticate an element instance:
Construct a JSON body as shown below (see Parameters):
{
"element": {
"key": "quickbooks"
},
"providerData": {
"code": "<AUTHORIZATION_GRANT_CODE>",
"realmId": "<REALMID_FROM_PREVIOUS_STEP>"
},
"configuration": {
"oauth.callback.url": "<CALLBACK_URL>",
"oauth.api.key": "<CONSUMER_KEY>",
"oauth.api.secret": "<CONSUMER_SECRET>",
"quickbooks.minorversion":"<VERSION_NUMBER>",
"authentication.type" : "oauth2",
"use_sandbox": "<true_or_false>",
"scope" : "com.intuit.quickbooks.accounting openid profile email phone address"
},
"tags": [
"<Add_Your_Tag>"
],
"name": "<INSTANCE_NAME>"
}
Call the following, including the JSON body you constructed in the previous step:
POST /instances
Locate the token
and id
in the response and save them for all future requests using the element instance.
curl -X POST \
https://api.cloud-elements.com/elements/api-v2/instances \
-H 'authorization: User <USER_SECRET>, Organization <ORGANIZATION_SECRET>' \
-H 'content-type: application/json' \
-d '{
"element": {
"key": "quickbooks"
},
"providerData": {
"code": "xxxxxxxxxxxxxxxxxxxxxxx",
"realmId": "xxxxxxxxxxxxxxxxx"
},
"configuration": {
"oauth.callback.url": "https;//mycoolapp.com",
"oauth.api.key": "xxxxxxxxxxxxxxxxxx",
"oauth.api.secret": "xxxxxxxxxxxxxxxxxxxxxxxx",
"quickbooks.minorversion":"23",
"authentication.type" : "oauth2",
"use_sandbox": "true",
"scope" : "com.intuit.quickbooks.accounting openid profile email phone address"
},
"tags": [
"Docs"
],
"name": "API Instance"
}'
API parameters not shown in Cloud Elements are in code formatting
.
Parameter | Description | Data Type |
---|---|---|
key |
The element key. quickbooks |
string |
code |
The authorization grant code returned from the API provider in an OAuth 2.0 authentication workflow. Cloud Elements uses the code to retrieve the OAuth access and refresh tokens from the endpoint. | string |
realmId |
The realmId returned upon user authorization.An identifier unique to QuickBooks that identifies the company that the authenticated instance is connected to | string |
name |
The name of the element instance created during authentication. | string |
oauth.api.key |
The API key or client ID obtained from registering your app with the provider. This is the Client ID that you noted in API Provider Setup. | string |
oauth.api.secret |
The client secret obtained from registering your app with the API provider. This is the Client Secret that you noted in API Provider Setup. | string |
oauth.callback.url |
The API key or client ID obtained from registering your app with the provider. This is the Redirect URI that you noted in API Provider Setup. | string |
authentication.type |
Identifies the authentication type to use with the request. | string |
quickbooks.minorversion |
A specific version of the API other than the generally available version. For more information, see Minor Versions in the QuickBooks docs. | STRING |
scope | Identifies the QuickBooks API access that your application is requesting. | string |
tags |
Optional. User-defined tags to further identify the instance. | string |
In this example, the instance ID is 12345
and the instance token starts with "ABC/D...". The actual values returned to you will be unique: make sure you save them for future requests to this new instance.
{
"id": 12345,
"name": "API Instance",
"createdDate": "2017-08-07T18:46:38Z",
"token": "ABC/Dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"element": {
"id": 39,
"name": "QuickBooks Online",
"hookName": "QuickBooksOnline",
"key": "quickbooks",
"description": "Add a QuickBooks Online Instance to connect your existing QuickBooks Online account to the Finance Hub, allowing you to manage your customers, employees, invoices, purchase orders etc. across multiple Finance Elements. You will need your QuickBooks Online account information to add an instance.",
"image": "elements/provider_quickbooks.png",
"active": true,
"deleted": false,
"typeOauth": true,
"trialAccount": false,
"configDescription": "If you do not have an QuickBooks account, you can create one at <a href=\"http://quickbooks.intuit.com/signup/\" target=\"_blank\">QuickBooks Signup</a>",
"signupURL": "http://quickbooks.intuit.com/signup/",
"defaultTransformations": [ ],
"objectMetadata": [ ],
"transformationsEnabled": true,
"bulkDownloadEnabled": true,
"bulkUploadEnabled": true,
"cloneable": false,
"extendable": true,
"beta": false,
"authentication": {
"type": "oauth1"
},
"extended": false,
"hub": "finance",
"protocolType": "http",
"parameters": [],
"private": false
},
"elementId": 39,
"tags": [
"Docs"
],
"provisionInteractions": [],
"valid": true,
"disabled": false,
"maxCacheSize": 0,
"cacheTimeToLive": 0,
"cacheTimeToLive": 0,
"configuration": { },
"eventsEnabled": false,
"traceLoggingEnabled": false,
"cachingEnabled": false,
"externalAuthentication": "none",
"user": {
"id": 12345
}
}
You can authenticate with QuickBooks Online to create your own instance of the QuickBooks Online in the UI or through APIs. Once authenticated, you can use the element instance to access the different functionality offered by the QuickBooks Online platform.
Use the UI to authenticate with QuickBooks Online and create an element instance. QuickBooks Online authentication follows the typical OAuth 1 framework and you will need to sign in to QuickBooks Online as part of the process.
If you are configuring events, see the Events section.
To authenticate an element instance:
After successfully authenticating, we give you several options for next steps. Make requests using the API docs associated with the instance, map the instance to a virtual data resource, or use it in a formula template.
Authenticating through API is a multi-step process that involves:
Use the following API call to request an Oauth Token. Replace 'keyOrId' with the element key, quickbooks
. You will also need to replace 'apikey', 'apisecret' and 'callbackUrl'.
GET /elements/{keyOrId}/oauth/token?apiKey=<api_key>&apiSecret=<api_secret>&callbackUrl=<url>
Query Parameter | Description |
---|---|
apiKey | The key obtained from registering your app with the provider. This is the Consumer Key that you recorded in API Provider Setup section. |
apiSecret | The secret obtained from registering your app with the provider. This is the Consumer Secret that you recorded in API Provider Setup section. |
callbackUrl | The URL that will receive the code from the vendor to be used to create an element instance. This is the Callback URL that you noted at the end of the Endpoint Setup section. |
curl -X GET
-H 'Content-Type: application/json'
https://api.cloud-elements.com/elements/api-v2/elements/{keyOrId}/oauth/token?apiKey=<api_key>&apiSecret=<api_secret>&callbackUrl=<url>'
{
"secret": "xxxxxx",
"token": "xxxxxxx"
}
You will use the token returned on this call to get the redirect URL and to provison the instance. The secret returned will be used as the oauth.api.user.secret.
Use the following API call to request a redirect URL where the user can authenticate with the API provider. Replace {keyOrId}
with the element key, quickbooks
.
GET /elements/{keyOrId}/oauth/url?apiKey=<api_key>&apiSecret=<api_secret>&callbackUrl=<url>&requestToken=insert_fake_request_token&state=quickbooks
Query Parameter | Description |
---|---|
apiKey | The key obtained from registering your app with the provider. This is the Consumer Key that you recorded in API Provider Setup section. |
apiSecret | The secret obtained from registering your app with the provider. This is the Consumer Secret that you recorded in API Provider Setup section. |
callbackUrl | The URL that will receive the code from the vendor to be used to create an element instance. This is the Callback URL that you noted at the end of the Endpoint Setup section. |
requestToken | The token returned from the previous step. |
curl -X GET
-H 'Content-Type: application/json'
'https://api.cloud-elements.com/elements/api-v2/elements/quickbooks/oauth/url?apiKey=fake_api_key&apiSecret=fake_api_secret&callbackUrl=https://www.mycoolapp.com/auth&state=quickbooks'
Use the oauthUrl
in the response to allow users to authenticate with the vendor.
{
"element": "quickbooks",
"oauthUrl": "https://appcenter.intuit.com/Connect/Begin?oauth_token=<fake_token>&oauth_callback=<fake_callback>%3Fstate%3Dquickbooks"
}
Provide the response from the previous step to the users. After they authenticate, QuickBooks Online provides the following information in the response:
Response Parameter | Description |
---|---|
oauth_verifier | The Authorization Grant Code required by Cloud Elements to retrieve the OAuth access and refresh tokens from the endpoint. |
realmID | The unique identifier for the authorized QuickBooks Online company. |
dataSource | This value determines what data source should be used for the connection. |
error
instead of the code
parameter. In this case, your application can handle the error gracefully.Use the /instances
endpoint to authenticate with QuickBooks and create an element instance. If you are configuring events, see the Events section.
To create an element instance:
Construct a JSON body as shown below (see Parameters):
{
"element": {
"key": "quickbooks"
},
"providerData": {
"oauth_token": "<OAUTH_TOKEN>",
"realmId": "<REALMID>",
"oauth_verifier": "<OAUTH_VERIFIER>",
"secret": "<OAUTH_USER_SECRET>",
"state": "quickbooks",
"dataSource": "<dataSource>"
},
"configuration": {
"oauth.callback.url": "<CALLBACK_URL>",
"oauth.api.key": "<CONSUMER_KEY>",
"oauth.api.secret": "<CONSUMER_SECRET>",
"filter.response.nulls": true
},
"tags": [
"<Add_Your_Tag>"
],
"name": "<INSTANCE_NAME>"
}
Call the following, including the JSON body you constructed in the previous step:
POST /instances
Locate the token
and id
in the response and save them for all future requests using the element instance.
curl -X POST \
https://api.cloud-elements.com/elements/api-v2/instances \
-H 'authorization: User <USER_SECRET>, Organization <ORGANIZATION_SECRET>' \
-H 'content-type: application/json' \
-d '{
"element": {
"key": "quickbooks"
},
"providerData": {
"oauth_token": "<OAUTH_TOKEN>",
"realmId": "<REALMID>",
"oauth_verifier": "<OAUTH_VERIFIER>",
"secret": "<OAUTH_USER_SECRET>",
"state": "quickbooks",
"dataSource": "QBO"
},
"configuration": {
"oauth.callback.url": "<CALLBACK_URL>",
"oauth.api.key": "<CONSUMER_KEY>",
"oauth.api.secret": "<CONSUMER_SECRET>"
},
"tags": [
"For Docs",
"tag 2"
],
"name": "QBO_Instance"
}'
API parameters not shown in Cloud Elements are in code formatting
.
Parameter | Description | Data Type |
---|---|---|
'key' | The element key. quickbooks |
string |
Namename |
The name for the element instance created during authentication. | Body |
oauth_verifier |
A verification code generated by Intuit that an App is supposed to pass back during the getaccesstoken step. | |
oauth_token |
The token retrieve in the Getting an Oauth Token step. | |
secret |
A secret to establish the ownership of the token. | |
realmId |
An identifier unique to QuickBooks that identifies the company that the authenticated instance is connected to. | |
state |
This should always be quickbooks | |
dataSource |
This value determines what data source should be used for the connection. It is returned after authentication. | |
oauth.callback.url |
The Callback URL from QuickBooks. This is the Callback URL that you noted at the end of the Endpoint Setup section. | |
oauth.api.key |
The Consumer Key from QuickBooks. This is the Consumer Key that you noted at the end of the Endpoint Setup section | string |
oauth.api.secret |
The Consumer Secret from QuickBooks. This is the Consumer Secret that you noted at the end of the Endpoint Setup section | string |
Filter null values from the response filter.response.nulls |
Optional. Determines if null values in the response JSON should be filtered from the response. Yes or true indicates that Cloud Elements will filter null values. Default: true . |
boolean |
tags | Optional. User-defined tags to further identify the instance. | string |
{
"id": 123,
"name": "test",
"token": "3sU/S/kZD36BaABPS7EAuSGHF+1wsthT+mvoukiE",
"element": {
"id": 39,
"name": "QuickBooks Online",
"key": "quickbooks",
"description": "Add a QuickBooks Online Instance to connect your existing QuickBooks Online account to the Finance Hub, allowing you to manage your customers, employees, invoices, purchase orders etc. across multiple Finance Elements. You will need your QuickBooks Online account information to add an instance.",
"active": true,
"deleted": false,
"typeOauth": true,
"trialAccount": false,
"configDescription": "If you do not have an QuickBooks account, you can create one at <a href=\"http://quickbooks.intuit.com/signup/\" target=\"_blank\">QuickBooks Signup</a>",
"signupURL": "http://quickbooks.intuit.com/signup/"
},
"provisionInteractions": [],
"valid": true,
"eventsEnabled": true,
"disabled": false,
"maxCacheSize": 0,
"cacheTimeToLive": 0,
"cachingEnabled": false
}
The QuickBooks Online element also allows for token based authentication. To provision an instance using this method, you are still required to have all of the OAuth information ahead of time.
curl -X POST \
https://api.cloud-elements.com/elements/api-v2/instances \
-H 'authorization: User <USER_SECRET>, Organization <ORGANIZATION_SECRET>' \
-H 'content-type: application/json' \
-d '{
"element": {
"key": "quickbooks"
},
"configuration": {
"oauth.callback.url":"<INSERT_CALLBACK_URL>",
"quickbooks.datasource": "<INSERT_DATASOURCE>",
"oauth.user.refresh_interval": "<INSERT_REFRESH_INTERVAL>",
"quickbooks.realm.id" : "<INSERT_REALM_ID>",
"oauth.user.token":"<INSERT_USER_TOKEN>",
"oauth.user.token.secret":"<INSERT_USER_TOKEN_SECRET>",
"oauth.api.key": "<INSERT_API_KEY>",
"oauth.api.secret": "<INSERT_API_SECRET>"
},
"tags": [
"QBO Token"
],
"name": "QBO Token",
"externalAuthentication": "initial"
}'
API parameters not shown in Cloud Elements are in code formatting
.
Parameter | Description | Data Type |
---|---|---|
'key' | The element key. quickbooks |
string |
Namename |
The name for the element instance created during authentication. | Body |
"oauth.user.refresh_interval" |
In seconds, the amount of time that should pass before a refresh needs to take place. The default for QuickBooks Online is 151 days or 13046400. | |
oauth.user.token |
The token retrieve in the Getting an Oauth Token step. | |
oauth.user.token.secret |
A secret to establish the ownership of the token. | |
quickbooks.realm.id |
The unique Identifier for the authorized QuickBooks company. | |
state |
This should always be quickbooks | |
quickbooks.dataSource |
This value determines what data source should be used for the connection. | |
oauth.callback.url |
The Callback URL from QuickBooks. This is the Callback URL that you noted at the end of the Endpoint Setup section. | |
oauth.api.key |
The Consumer Key from QuickBooks. This is the Consumer Key that you noted at the end of the Endpoint Setup section | string |
oauth.api.secret |
The Consumer Secret from QuickBooks. This is the Consumer Secret that you noted at the end of the Endpoint Setup section | string |
Filter null values from the response filter.response.nulls |
Optional. Determines if null values in the response JSON should be filtered from the response. Yes or true indicates that Cloud Elements will filter null values. Default: true . |
boolean |
tags | Optional. User-defined tags to further identify the instance. | string |
{
"id": 123,
"name": "test",
"token": "3sU/S/kZD36BaABPS7EAuSGHF+1wsthT+mvoukiE",
"element": {
"id": 39,
"name": "QuickBooks Online",
"key": "quickbooks",
"description": "Add a QuickBooks Online Instance to connect your existing QuickBooks Online account to the Finance Hub, allowing you to manage your customers, employees, invoices, purchase orders etc. across multiple Finance Elements. You will need your QuickBooks Online account information to add an instance.",
"active": true,
"deleted": false,
"typeOauth": true,
"trialAccount": false,
"configDescription": "If you do not have an QuickBooks account, you can create one at <a href=\"http://quickbooks.intuit.com/signup/\" target=\"_blank\">QuickBooks Signup</a>",
"signupURL": "http://quickbooks.intuit.com/signup/"
},
"provisionInteractions": [],
"valid": true,
"eventsEnabled": true,
"disabled": false,
"maxCacheSize": 0,
"cacheTimeToLive": 0,
"cachingEnabled": false
}