(OAuth) Token has been expired or revoked

17,345 views
Skip to first unread message

Alex Garcia

unread,
Feb 28, 2022, 12:46:30 PM2/28/22
to Google Ads API and AdWords API Forum
We are having problems with the refresh token.


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.

We have changed the status from Testing to In Production:

check.jpg

But still getting the refresh token expired after 7 days. This is the error message we get when trying to authenticate:

ERROR: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:
{
  "error": "invalid_grant",
  "error_description": "Token has been expired or revoked."
}

How can we solve this issue?

Alex Garcia

unread,
Feb 28, 2022, 1:04:51 PM2/28/22
to Google Ads API and AdWords API Forum
By the way, the change from Testing to In Production, we did it 7 days ago, and we checked to day, for the refresh token expiration.

So even with the "In production" status, we are still getting our refresh token disabled after 7 days, which makes no sense.

Google Ads API Forum Advisor

unread,
Mar 1, 2022, 3:32:16 AM3/1/22
to hust...@gmail.com, adwor...@googlegroups.com

Hello Alex,

Thank you for reaching out to us.

Please note that this forum channel can only provide assistance to issues/concerns related to the AdWords API / Google Ads API.

I'm afraid that concerns related to refresh token expiration is already outside of our team's expertise. We recommend that you reach out to the Console Team via this link instead.

As an aside, for the OAuth2 desktop app flow, you can persist a refresh token (see also factors that may affect refresh token expiration) to obtain a new access token whenever necessary. When using one of our client libraries, you can authorize your app by filling out a configuration file.

Regards,

Google Logo
Mark Kevin
Google Ads API Team
 


ref:_00D1U1174p._5004Q2XjtpY:ref

Alex Garcia

unread,
Mar 2, 2022, 11:39:07 AM3/2/22
to Google Ads API and AdWords API Forum
Can you please confirm the following?

When we change the status of the Project OAuth from TESTING to IN PRODUCTION, should we generate a NEW Google Client ID and Google Client Secret?

We did the test with the OLD Google Client ID and Google Client Secret (after changing from TESTING to IN PRODUCTION), and that might be the cause for it to doesn't work as expected (expired after 7 days).

Google Ads API Forum Advisor

unread,
Mar 3, 2022, 8:32:04 AM3/3/22
to hust...@gmail.com, adwor...@googlegroups.com
Hi Alex,

Thank you for your follow up question.

The 7 day expiration should only apply to the (TESTING) refresh token. As for the client_id and client_secret, there should be no need to generate new ones.

Should you have additional questions related to the tokens and the credentials, and factors that may affect expiration, you may reach out instead to the Google API Console support team. I hope this helps.

Best regards,

Google Logo
Peter Laurence
Google Ads API Team
 


ref:_00D1U1174p._5004Q2XjtpY:ref

Alex Garcia

unread,
Mar 3, 2022, 9:02:39 AM3/3/22
to Google Ads API and AdWords API Forum
In order to get access to Google Ads API Console support team you need to pay for a higher tier of support.

Can you please confirm that the Project is indeed, "In production" status? With the screenshot provided.

It seems like the verification process got stuck and it's not moving forward, but I think the Project is already "In production".

Google Ads API Forum Advisor

unread,
Mar 4, 2022, 2:39:38 AM3/4/22
to hust...@gmail.com, adwor...@googlegroups.com
Hi Alex,

Thank you for providing more details to your concern.

Based on the provided screenshot, I can see that you have already "In production" publishing status so the 7 days expiration seems not applicable on the error that you encountered. But please note that there are different reasons why the refresh token is expiring and you can see it on this document.

However, since the issue is more specific to refresh tokens, then I would suggest reaching out to the more equipped team for this concern via this link.

Regards,
Google Logo
Ernie John
Google Ads API Team
 


ref:_00D1U1174p._5004Q2XjtpY:ref

Alex Garcia

unread,
Mar 4, 2022, 9:00:41 AM3/4/22
to Google Ads API and AdWords API Forum
The link provided requires to pay to get access to support. We are not willing to do so, to get help.

Google Ads API Forum Advisor

unread,
Mar 7, 2022, 5:44:12 AM3/7/22
to hust...@gmail.com, adwor...@googlegroups.com
Hi Alex,

Thank you for reaching out to Google Ads API Forums.

It appears that your concern is related to refresh token expiration. With this, I would recommend posting your concern here, this was also included inside the support link my colleague provided. This is a public forum which is dedicated to Oauth2 and refresh token related questions. I hope this helps.

Let us know if you have any questions.

Regards,
Google Logo
Carmela
Google Ads API Team
 









 

ref:_00D1U1174p._5004Q2XjtpY:ref

Alex Garcia

unread,
Mar 7, 2022, 3:23:22 PM3/7/22
to Google Ads API and AdWords API Forum
For anyone having this problem. You actually need to create NEW OAuth credentials, after you have upgraded the OAuth from TESTING to IN PRODUCTION.

I did that, and now it works. If you used the old credentials, the Refresh Token is going to expire after 7 days.

Google Ads API Forum Advisor

unread,
Mar 8, 2022, 5:22:46 AM3/8/22
to hust...@gmail.com, adwor...@googlegroups.com
Hi Alex,

Thank you for the information you added regarding this topic. If you then have additional questions or clarifications regarding the OAuth2 credentials, feel free to send those over to our team so we can discuss and provide you with recommendations.

Best regards,
Google Logo
Heidi
Google Ads API Team
 


ref:_00D1U1174p._5004Q2XjtpY:ref
Reply all
Reply to author
Forward
0 new messages