RE: 'invalid_grant: Bad Request' for AdwordsUserListService mutate call ...

2019-02-12 Thread googleadsapi-forumadvisor via AdWords API and Google Ads API Forum


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
  
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: ""*

*  # 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 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: "http://console.developers.google.com> (type
Other)>"*
*  client_secret: "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: ""*

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= \*
*-d client_id= \*
*-d client_secret= \*
*-d access_type=offline \*
*-d grant_type=refresh_token*

I get back:

*{*
*  "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/25881df7-dafb-4a47-8d28-e36d9c6f84b5%40googlegroups.com

.
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 

'invalid_grant: Bad Request' for AdwordsUserListService mutate call ...

2019-02-12 Thread tom
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: ""*

*  # 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 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_secret: ""*

*  # 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: ""*

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= \*
*-d client_id= \*
*-d client_secret= \*
*-d access_type=offline \*
*-d grant_type=refresh_token*

I get back:

*{*
*  "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/25881df7-dafb-4a47-8d28-e36d9c6f84b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.