Discussions

Ask a Question
Back to All

CloudFront 504 Error During Access Token Retrieval via API

We are experiencing an issue with our application that connects ServiceM8 to HubSpot. After running successfully for some time, the app started failing during the Access Token generation, resulting in a CloudFront 504 Gateway Timeout error. The error message states:

"CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection."

The primary issue is that the refresh token has stopped working, even after multiple attempts. When trying to generate a new access token, we receive the following error:

{"error":"invalid_grant","error_description":"Refresh token previously used. Cannot be used twice."}

This issue persists and does not resolve automatically. The only workaround is to reinstall the app and generate a new refresh token, which is not an ideal solution. We need assistance in identifying the root cause and implementing a permanent fix.
Thanks.

Best regards,
Ali
App Developer | EmeraldSoft