Google Drive OAuth: invalid grant while refreshing token
Trying to refresh access to Google Drive ends with invalid grant, and attachments in CRM are not synced.
Why is there a problem?
Fresh token may be invalid after the consent has been revoked, the authorisation conditions changed or the OAuth application configuration problem.
Diagnostics and solutions
1. Check the error code and the time of the last successful sync without revealing secrets.
2 . Verify OAuth client, ranges and redirect URI for the right environment.
3 . Check that the application stores the correct refresh token on the server.
4 . When required, execute the user's consent again and test new access to the folder.
5 . Add the integration failure alert and the possibility of safe rewriting.
How to check and avoid what?
OAuth gets access according to consent, the document is stored in the correct folder, and another attempt to renew the cannon.
Do not solve an error by entering a fresh token into a frontend file or sending it in logs.