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 (type Other)>"
  client_secret: "<Again from the 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 \
-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";,
  "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/fe77103f-6208-4771-9ee5-154cedf11bce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to