Message: Token has been expired (while token still works)

17 views
Skip to first unread message

trespaan

unread,
Jul 1, 2024, 8:15:42 PMJul 1
to Google Ads API and AdWords API Forum

Hello,

I've built an internal API to retrieve historical metrics for keywords using a Python/Flask application. After thoroughly programming and testing it on my localhost, everything worked perfectly: the client loaded correctly, and metrics were returned as expected.

I then deployed the repository on my Linode server, where the Google Search Console API was already running. Initially, both the search console and Google Ads routes worked fine. However, after five days, the Google Ads route started returning the following error:

``` 
google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked.', {'error': 'invalid_grant', 'error_description': 'Token has been expired or revoked.'})
```

I've attempted various methods to resolve this issue:

  • Loading the client differently
  • Generating a new refresh token
  • Verifying the API key

Despite these efforts, the application continues to work flawlessly on localhost but not on the Linode server.

Has anyone encountered this problem before or have any suggestions on what to check next?

Thanks!

Reply all
Reply to author
Forward
0 new messages