Adwords API OAuth2 : "error": "invalid_grant", "error_description": "Bad Request"

96 views
Skip to first unread message

service....@sonovente.com

unread,
Jan 29, 2019, 11:57:30 AM1/29/19
to AdWords API and Google Ads API Forum
Hello,

With the update of the Adwords API, I wanted to test my code with an "old" test account with an Adwords test campaign. But I ended up with the error:
{
  "error": "invalid_grant",
  "error_description": "Bad Request"
}

So I recreated a new Oauth2 Credential of type "Other" on the developer console and I requested a new "refreshToken", using this call :
but it is still impossible to connect.

To test my information I am using the following call :
curl \
  -d refresh_token=XXXX \
  -d client_secret=XXXXX \
  -d grant_type=refresh_token https://www.googleapis.com/oauth2/v4/token

and I always end up with :
{
  "error": "invalid_grant",
  "error_description": "Bad Request"
}

With my production credential , the curl call is working great.

Thank
Fabien

googleadsapi...@google.com

unread,
Jan 29, 2019, 4:38:09 PM1/29/19
to AdWords API and Google Ads API Forum
Hello,

The "invalid_grant" error usually indicates that the access or refresh token being passed in your request is incorrect or invalid. Your curl request seems fine. If your curl request working, then the credentials are good and you can use the same credentials in the API call. In case, you are facing invalid grant with the test account make sure the email address used to generate credentials has access to the test account. If not, you could create the Oauth credentials with the user having access to the test account by referring this guide. If you are still facing the issue please share the email address using which the credentials are generated and the account CID making API calls to along with screenshots of the scenario you are performing. You could use reply privately to the author option while sharing the information requested.

Regards,
Sai Teja, AdWords API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

Reply all
Reply to author
Forward
0 new messages