invalid_grant error suddenly happening after 18 months of stable server side code

1,711 views
Skip to first unread message

PPC Developer

unread,
Feb 23, 2017, 9:23:36 PM2/23/17
to AdWords API Forum
Hi,

This is perplexing...Our solution uses OAuth2 with refresh tokens and we have multiple C# clients deployed on multiple machines running on windows, managing our accounts MCC child accounts.

Suddenly, the clients all started having invalid_grant errors. This is a pretty stable code that has been running for 18 months without any issues. See below the error details. We're using .NET client library, implementation with C#.

Please let us know what the issue is with our access token?



HRESULT -2146233088
Failed to refresh access token.
{
  "error" : "invalid_grant"
}


j.e.frank

unread,
Feb 23, 2017, 9:55:59 PM2/23/17
to AdWords API Forum
We are also seeing invalid_grant errors just now.

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Feb 23, 2017, 10:04:24 PM2/23/17
to AdWords API Forum
Hi,

The 'invalid_grant' error usually occurs when the authorization code or the refresh token is not valid (is expired, revoked, issued to another client etc). To fix this, you will need to generate the refresh token again. If you need instructions to generate a new one, please check our guide.

Refresh tokens usually have a long expiration term however they could stop working due to any of the reasons given here

Could both of you try to regenerate the refresh token? If it still doesn't work, please reply privately to author and share the complete SOAP request.

Thanks,
Sreelakshmi, AdWords API Team

di...@easyleads.com

unread,
Feb 24, 2017, 12:53:38 AM2/24/17
to AdWords API Forum
Same thing here.

A long running code stopped working several hours ago due to this error, but now it seems to work again. With the same refresh tokens.

di...@easyleads.com

unread,
Feb 24, 2017, 1:33:56 AM2/24/17
to AdWords API Forum
No, still fails from time to time.

Currently I have only phone, can send a request in several hours. I think there is an issue on your side.

David Zuercher

unread,
Feb 24, 2017, 2:33:05 AM2/24/17
to AdWords API Forum
We started getting this same error this afternoon. Python code running against the adwords api. Same credentials/tokens for at least 2 years.

di...@easyleads.com

unread,
Feb 24, 2017, 4:42:00 AM2/24/17
to AdWords API Forum, Assaf Frank
Hi,

Just sent Sreelakshmi Sasidharan an example of http request that I ran 10 times - 4 times got access token and 6 times the invalid grant error.

This is a critical issue for us, so in case Sreelakshmi isn't available now - please somebody check it.

AdWordsApiUser

unread,
Feb 24, 2017, 5:33:39 AM2/24/17
to AdWords API Forum
Same Issue - many of our customers are affected. We are not able to refresh the tokens anymore. This is quite urgent.

David Zuercher

unread,
Feb 24, 2017, 5:40:02 AM2/24/17
to AdWords API Forum
We generated new OAuth2 credentials through the https://console.cloud.google.com and then we were able to create new refresh tokens. Seems to be working so far.


On Thursday, February 23, 2017 at 2:23:36 PM UTC-7, PPC Developer wrote:

AdWordsApiUser

unread,
Feb 24, 2017, 6:02:01 AM2/24/17
to AdWords API Forum
It seems to be a google wide issue: https://productforums.google.com/forum/?nomobile=true#!topic/gmail/Kfsx8YjqAS4

Any recommendation for hosted tools? It will be a lot of work if all users have to reauthorize permissions.

Stefan Kleine Stegemann

unread,
Feb 24, 2017, 7:04:49 AM2/24/17
to AdWords API Forum

Hi,

we're also experiencing this issue for some hours now.  For around 50 adwords accounts connected to our system, the refresh tokens suddenly stopped working. We're also getting the "invalid_grant" error message. It will be a lot of work to re-authorize all of the affected customers, any advise on this? Can we expect the refresh tokens to be working again or are they lost?

As a side note, some refresh tokens we have obtained for the content api also stopped working.

Regards,
Stefan

Stefan Kleine Stegemann

unread,
Feb 24, 2017, 7:20:00 AM2/24/17
to AdWords API Forum

As additional information, it seems that the tokens are working "sometimes". For a few accounts, I created an AdWords session multiple times and occasionally, it works. That said, most of the times, it does not work.

Best,
Stefan

Stefan Kleine Stegemann

unread,
Feb 24, 2017, 7:34:08 AM2/24/17
to AdWords API Forum

Autoeurope Developer

unread,
Feb 24, 2017, 8:22:16 AM2/24/17
to AdWords API Forum
I'm also getting Invalid Grant Messages on a system that has been working fine for over 30 days. Issue started this morning.

{ "error": "invalid_grant", "error_description": "Bad Request" } 

rob....@euautomation.com

unread,
Feb 24, 2017, 8:45:31 AM2/24/17
to AdWords API Forum
Same Issue here.

Probably linked to this:

https://productforums.google.com/forum/?nomobile=true#!category-topic/gmail/Kfsx8YjqAS4

Google seem to have invalidated loads of tokens, logged me out my phone last night.

Autoeurope Developer

unread,
Feb 24, 2017, 8:48:32 AM2/24/17
to AdWords API Forum
Yep. I just logged into Adwords, generated a new developer token and all is working again.

Nick

unread,
Feb 24, 2017, 10:37:27 AM2/24/17
to AdWords API Forum
I had the errors pop up about 9 hours ago.
I just sat down to fix it but notice that it's all working fine again now. So perhaps they were suspended temporarily?

Danial Klimkin

unread,
Feb 24, 2017, 11:27:25 AM2/24/17
to AdWords API Forum
Hello All,


We can confirm this was an intermittent issue on our side that is fully resolved now.

Sorry for the inconvenience. If you are still affected please reach out to us.


-Danial, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages