Gong OAuth refresh token invalid_grant — What it means & how to fix it
Blog post from Nango
Gong's integration via OAuth 2.0 can lead to refresh token failures, particularly when tokens are not handled correctly, which can disrupt sync jobs and dashboards, prompting customer inquiries about disconnections. These failures usually manifest as "invalid_grant" errors because Gong's refresh tokens are single-use, meaning each successful refresh invalidates the previous token. Common issues include concurrency problems with multiple workers, incorrect OAuth app credentials, and mismatched OAuth assumptions since Gong operates at a global rather than user level. To address these issues, it's crucial to persist the latest refresh token after each successful update, implement single-flight refreshes per connection, verify endpoint usage, and treat persistent errors as a need for re-authentication. Additionally, open-source tools like Nango can automate the management of token lifecycles, offering pre-built OAuth flows and handling complex scenarios to reduce the manual burden on developers.