Hi Tom,

The usual reason for having the invalid_grant issue is due to an expired
refreshToken. However, I would like to recommend that you regenerate all
your OAuth2 credentials
<https://developers.google.com/adwords/api/docs/guides/authentication> including
the client_id and client_secret and retry your request. Should the issue
persist, kindly reply to me privately (via *Reply privately to author*) the
logs along with the email address you used when generating your OAuth2
credentials so I can further investigate.

Thanks and regards,
Peter
AdWords API Team


On 02/12/19 12:33:08 t...@v1.com.au wrote:

I have read through the variety of "invalid_grant" questions on this board,
but unfortunately didn't find anything that helped resolve my particular
issue.

I am trying to get the samples working with the following config in my
googleads.yaml:

*  # This token has been approved and has Access level "Basic Access"*
*  developer_token: "<token from Tools/API Center/API Access/Developer
token on the MCC account>"*

*  # We are only interested in automating tasks to our single ad account.
The MCC with our developer token manages that account.*

*  client_customer_id: "<the ID for the single ad account managed by the
MCC account>"*

*
#############################################################################*
*  # The following values configure the client for the installed
application*
*  # flow.*

*  # The account I use to manage the credentials is not the same as the one
with the MCC account, is this significant? *
*  # (I did try creating the credentials on the MCC account and had the
same issue, so I think not).*
*  client_id: "<Client ID from the credentials section on
console.developers.google.com <http://console.developers.google.com> (type
Other)>"*
*  client_secret: "<Again from the console.developers.google.com
<http://console.developers.google.com> credentials entry>"*

*  # When I generated this token I authenticated as the MCC account (which
has access to the managed google ads account -> client_customer_id above).*
*  refresh_token: "<Token generated using the generate_refresh_token.py
tool (using the credentials above>"*

When I check https://myaccount.google.com/permissions I can see the details
specified in the "OAuth consent screen" as having access to "Manage your
AdWords campaigns".

When I use:

*curl https://www.googleapis.com/oauth2/v4/token
<https://www.googleapis.com/oauth2/v4/token> \*
*-d refresh_token=<refresh token above> \*
*-d client_id=<client id above> \*
*-d client_secret=<client secret above> \*
*-d access_type=offline \*
*-d grant_type=refresh_token*

I get back:

*{*
*  "access_token": "<new access token>",*
*  "expires_in": 3600,*
*  "scope": "https://www.googleapis.com/auth/adwords
<https://www.googleapis.com/auth/adwords>",*
*  "token_type": "Bearer"*
*}*

Which seems healthy.

When I run the sample code from here ->
https://developers.google.com/adwords/api/docs/samples/python/remarketing
"Create and populate a user list"

It fails on this line (presumably the first time it tries to authenticate):

*result = user_list_service.mutate(operations)*

with:

*google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', '{\n
"error": "invalid_grant",\n  "error_description": "Bad Request"\n}')*

I have tried regenerating a refresh tokens (authenticated on other accounts
who have access to the ad account I need to manage) with little success.

I have noticed on similar questions you have asked for a private reply with
account details to investigate further and I would be happy to do that.

Thanks.



--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/25881df7-dafb-4a47-8d28-e36d9c6f84b5%40googlegroups.com
<https://groups.google.com/d/msgid/adwords-api/25881df7-dafb-4a47-8d28-e36d9c6f84b5%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/180iek00000000010vuogm007rqi7iz74mj2dhl74o30c1g68qjacph%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
  • 'invali... tom
    • RE... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum

Reply via email to