Closed sgpascoe closed 1 year ago
+1 can some of the lib authors please elaborate on this one?
I'm tempted to implement a puppeteer function to fetch it's own refresh token if it's not working 🤣
Hi @sgpascoe @mkosik, apologies for the delayed response, we are very busy at the moment at Opteo. This library is only a wrapper around the Google Ads API, we are not involved in refresh tokens. I suggest asking your question instead at the Google Ads API forum.
@wcoots This library is only a wrapper around the Google Ads API, we are not involved in refresh tokens. I suggest asking your question instead at the Google Ads API forum.
They have replied:
Hi Sam,
Thank you for posting your concern. Allow me to provide support.
I can see that you encountered an invalid_grant error, it occurs when the refresh token has been expired or revoked. The common cause of this error is when a Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of "Testing" is issued a refresh token expiring in 7 days. Your Google project's publishing status is "Testing", so the refresh token expires every 7 days and receives an “invalid_grant” error. Go to the Google API Console and navigate to the OAuth consent screen. Then change the publishing status to “In production” following these instructions to avoid the refresh token expiring in 7 days.
Is this not related to the token given here: https://refresh-token-helper.opteo.com/ ?
Hi @sgpascoe -- The refresh token helper tool is meant as a quick way to get started, not really as a permanent solution :)
That said, based on Google Support's response, it sounds like you'll get longer-lived tokens if you change your Google Project's publishing status (likely the one associated with the client_id you're using in the helper tool).
Consider checking the helper tool's source code -- it shows just how simple it is to get new tokens. Certainly much faster than setting up a puppeteer scraper!
It seems like this keeps happening every week or so, and I need to go through the process of getting a new refresh token every time from here, which then fixes the issue.