intuit / QuickBooks-V3-Java-SDK

Java SDK for QuickBooks REST API v3 services
Apache License 2.0
70 stars 142 forks source link

Failed getting access token #159

Closed malmyros closed 3 years ago

malmyros commented 3 years ago

We have implemented an integration with QuickBooks using the SDK but our customers are getting in a state where when a token has expired we can't refresh it using the OAuth2PlatformClient.

Dependencies: ipp-v3-java-data-6.0.10.jar ipp-v3-java-data-6.0.10-sources.jar ipp-v3-java-devkit-6.0.10-jar-with-dependencies.jar

Workflow:

1). System requests for data from quickbooks 2). Request fails because the token has expired:

ERROR CODE:3200, ERROR MESSAGE:message=AuthenticationFailed; errorCode=003200; statusCode=401, ERROR DETAIL:Token expired: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

3). We then use OAuth2PlatformClient to update the token

BearerTokenResponse bearerTokenResponse = client.refreshToken(quickBooksSync.getRefreshToken());

4). At this point we receive an OAuthException exception :

Message: failed getting access token Error Code: null Error Message: failed getting access token

We have instructed our customers to re-authorise with QuickBooks but we shouldn't need to do any of this as the token has simplify expired and the customer hasn't revoked the any access.

Could you please provide some help?

fjolin-intuit commented 3 years ago

@malmyros Do you have any logs that you could send here with some context? The headers in the response of the failed Oauth call will contain an intuit_tid which we could use to track down the issue. Without logs I could only guess but a common issue is that the refresh token has changed in a previous call but was not persisted. So when quickBooksSync.getRefreshToken() is returning an older refresh token. Each time a call to refresh tokens occurs the access and refresh need to be persisted. Again just a guess.