I am using a Google Ads php library (https://github.com/googleads/googleads-php-lib) to manage my own google ads account, following Google's instructions here (https://developers.google.com/adwords/api/docs/guides/first-api-call)
(I've actually been doing this for many years without a problem, but I recently switched over to using a different project in the Google Cloud Platform, so I had to update my credentials and get a new refresh token)
To get a new refresh token, I ran the php script called GetRefreshTokenWithoutIniFile.php
(which allows me to grant offline access and retrieve a new refresh token, which I store in a file auth.ini
for future use).
The refresh token last for a few days, before I see this error:
{
"error" : "invalid_grant",
"error_description" : "Token has been expired or revoked."
}
I have been using the above method for years and the refresh token has never expired. However, it now seems to expire every couple of days. I am certainly not 'running out' of refresh tokens (I only request one), and the user is not revoking access (the user is me). For that reason, these similar answers don't help me:
'Token has been expired or revoked' - Google OAuth2 Refresh token gets expired in few days suggests an issue with 'security activity', but I see no security issues in my google account.
Google token refresh returns "Token has been expired or revoked." and Since couple of days Refresh token has been automatically expired suggest the problem may be too many refresh tokens - however, I only retrieve the token once and re-use the same one (until it expires!)
According to Token has expired or revoked - Google Ads, a refresh token won't persist unless the app is in 'production' mode. However, I tried that solution and it did not work: the token still expires after a few more days.
Any more ideas?