Handling QuickBooks OAuth Token Expiration and Refresh Failures
When a QuickBooks Online integration stops syncing, the most common cause is a failed OAuth token refresh. You can fix this by validating your client credentials, checking the refresh token status, and reauthorizing the connection. Follow the steps below to restore the sync and prevent future breaks.
Diagnosing token refresh failures
Intuit issues access tokens with a short lifespan and refresh tokens that last longer. The system expects your app to use the refresh token before the access token expires. When the refresh request fails, the server returns an error that stops data flow. You will usually see this in your application logs.
{
"error": "invalid_grant",
"error_description": "The refresh token has expired or was revoked."
}
This error means the stored refresh token is no longer valid. Intuit revokes refresh tokens when a user changes their password, revokes app access, or when the token exceeds its maximum lifetime. Your app must catch this response and trigger a new authorization flow.
Restoring the token refresh connection
Run these steps in order to recover the connection. Each step addresses a specific failure point.
- Verify your client credentials. Log into the developer portal and confirm that your client ID and client secret match the values stored in your app. A mismatched secret causes immediate authentication failures.
- Check the server clock. Token validation relies on accurate time. A drift of more than a few minutes will cause the refresh handshake to fail. Sync your server with a reliable network time source.
- Test the refresh endpoint. Use a command line tool to send the refresh request. This isolates whether the problem lives in your code or in the stored token.
curl -X POST https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=refresh_token&refresh_token=YOUR_REFRESH_TOKEN&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET"
- Reauthorize the app. If the refresh token returns
invalid_grant, you must restart the OAuth flow. Direct the user to log into QuickBooks Online and grant permission again. This generates a fresh pair of tokens. - Verify data flow. Run a test transaction or pull a recent customer list. Confirm that the new access token works before resuming automated syncs.
Preventing silent sync breaks
A failed refresh often goes unnoticed until missing invoices surface. You can catch these failures early by adding structured logging. Log the HTTP status code and error message for every token request. Set up an alert that triggers on 401 or 403 responses. You can also review our QuickBooks Online help, how-tos, and troubleshooting guide for deeper authentication details. We recommend scheduling a daily health check that attempts a lightweight token refresh. Record the result and send a summary to your operations channel. Set up this daily health check now to catch credential drift before it impacts your books.