List Accessible Accounts stuck in error loop

291 views
Skip to first unread message

Jack Reidy

unread,
Apr 28, 2022, 5:28:08 PM4/28/22
to Google Ads API and AdWords API Forum
Hi team, 

During a request to CustomerService/ListAccessibleCustomers if the credentials the end user inputs are invalid I see a response error of "invalid_grant" with description "Bad Request". This is expected, however the client never returns and continually reattempts the bad request. Since the request does not return I can not return the proper error message and the code hangs. I am wondering if there is a way to configure the CustomerServiceClient to either disable this feature or change the number retry attempts. I have not been able to find very much in the documentation on this topic. Any help is appreciated. Below is a sample request/response I am using the Java Google Ads v10 client library:

Request

-------

MethodName: google.ads.googleads.v10.services.CustomerService/ListAccessibleCustomers

Endpoint: googleads.googleapis.com:443

Headers: {developer-token=REDACTED, x-goog-api-client=gl-java/1.8.0_311 gccl/17.0.1 gapic/17.0.1 gax/2.6.1 grpc/1.41.0}

Body: 

Response

--------

Headers: null

Body: null

Failure message: null

Status: Status{code=UNAVAILABLE, description=Credentials failed to obtain metadata, cause=com.google.api.client.http.HttpResponseException: 400 Bad Request

POST https://oauth2.googleapis.com/token

{

  "error": "invalid_grant",

  "error_description": "Bad Request"

}

Google Ads API Forum Advisor

unread,
May 1, 2022, 11:16:19 PM5/1/22
to jack....@groupm.com, adwor...@googlegroups.com
Hi Jack,

Thank you for reaching out. I am a member of the Google Ads API team.

Moving forward to your concern, "I am wondering if there is a way to configure the CustomerServiceClient to either disable this feature or change the number retry attempts.", I am afraid that there's no possible way to configure the CustomerServiceClient in this way. However, this should be implemented on the developers end.

Also, please see the statements below:
  • I noticed in your provided logs that you have encountered the invalid_grant error. That said, since this is an issue on implementation of your authentication, then I would suggest checking this documentation which contains the authentication process.
  • I also noticed that your request body is empty. That said, please try this java code on your end.

Regards,
Google Logo
Carmela
Google Ads API Team
 


ref:_00D1U1174p._5004Q2aOfyr:ref

Jack Reidy

unread,
May 2, 2022, 1:57:50 PM5/2/22
to Google Ads API and AdWords API Forum
Hi,

Thank you for the response. The code you replied with is what is running. The problem is I am supporting multiple users and this error occurs when they do not properly enter the correct credentials. When they do enter the correct details the code proceeds as expected. In both cases the google ads client appears to be set up properly. I need a way of reporting back to the user the results of the call, i.e. if it is a bad request I should be able to alert the user that they entered their credentials incorrectly. Would it be possible to test the credentials I receive from the end user with a separate GRPC call?

Best,
Jack 

Google Ads API Forum Advisor

unread,
May 3, 2022, 11:07:46 PM5/3/22
to jack....@groupm.com, adwor...@googlegroups.com
Hi Jack,

Thank you for your reply.

For the scenario where the ListAccessibleCustomers requests are stuck in a loop, and apart from the complete logs, could you also share the request-id if available?

In addition, could you point out specifically what incorrect details the users' input, is it an incorrect set/combination of credentials, or for example the characters of the credentials were incomplete? This is so that I can raise this issue to the rest of our team so we can investigate further and provide possible recommendations.

For the additional logs details that I requested, you may then send the requested information via the Reply privately to author option. If this option is not available, you may send these directly to our googleadsa...@google.com alias instead.

As for your other question "Would it be possible to test the credentials I receive from the end user with a separate GRPC call?", any other API request using incorrect credentials should result in an authentication error.

Best regards,

Google Logo
Peter Laurence
Google Ads API Team
 


ref:_00D1U1174p._5004Q2aOfyr:ref

Dean Povey

unread,
May 4, 2022, 11:32:31 AM5/4/22
to Google Ads API and AdWords API Forum
I had this same problem (assuming you are using the Java API). It seems to be a bug in the OAuth library. I upgraded to: com.google.apis/google-api-services-oauth2 v2-rev157-1.25.0 and it now seems to fail with an exception.

com.google.api.gax.rpc.UnavailableException: io.grpc.StatusRuntimeException: UNAVAILABLE: Credentials failed to obtain metadata

Dean Povey

unread,
May 4, 2022, 11:33:14 AM5/4/22
to Google Ads API and AdWords API Forum
Err in case it wasn't clear, that's what I expect should happen :-). So now fixed.
Reply all
Reply to author
Forward
0 new messages