SAP Cloud Platform Open Connectors

Why am I seeing "Authentication with the provider failed"?

If you are seeing the below error response when attempting to perform a QuickBooks Online call:

{ "requestId": "xxxxxxxxxxx",
"message": "Authentication with the provider failed. OAuth token refresh may have encountered problems. If problem continues, edit your element instance and ensure that access has not been revoked from the provider.",
"providerMessage": "3200 - message=ApplicationAuthenticationFailed; errorCode=003200; statusCode=401 – null” }

You can test a shorter refresh interval by using Intuit's Developer Playground using the below steps:

  1. Go to https://appcenter.intuit.com/Playground/OAuth/IA. Populate the key and secret and then specify how much time (in seconds) you would like to test for the expiration of your tokens.
  2. Click "Connect to Quickbooks". Go through the Oauth flow.
  3. After you have completed the Oauth flow, there will be a page that includes a realm id, token and secret. You will use these to POST https://api.cloud-elements.com/elements/api-v2/instances. You will use the following payload:
    {
    "element": {
    "key": "quickbooks"
    },
    "configuration": {
    "oauth.callback.url":"http://www.cloud-elements.com",
    "oauth.user.refresh_interval": "<time set in playground>",
    "quickbooks.realm.id" : "<realm id>",
    "oauth.user.token":"<token>",
    "oauth.user.token.secret":"<secret>",
    "oauth.api.key": "xxxxxxxxxxxxxxxxxxx",
    "oauth.api.secret": "xxxxxxxxxxxxxxxx",
    "quickbooks.datasource": "QBO",
    "oauth.user.refresh_time": "<current time converted to epoch, use http://www.epochconverter.com/>"
    },
    "tags": [
    "QBO Token"
    ],
    "name": "QBO Token",
    "externalAuthentication": "initial"
    }
  4. After you have posted the instance, continually call one of the endpoints from the instance until the refresh interval has expired. For example, if you set it to 120 seconds, make sure you are making API calls for at least two minutes.
  5. Immediately after the refresh interval has passed, do another call to ensure it is still working.
  6. Do a GET /instances/{id}. Review the oauth.user.refresh_time and see it has been updated to when the token was refreshed.

NOTE: due to the shorter time interval, you run the risk of getting a "Refresh out of bounds" error message if you don't attempt it within a specified time frame. This is a QuickBooks limitation.