Need help debuging unauthorized error

221 views
Skip to first unread message

Sifang Chu

unread,
Oct 3, 2019, 4:48:11 PM10/3/19
to AdWords API and Google Ads API Forum
Hi,

Our company is an existing user of ADWords API. I'm starting to experiment with Ads API. I have just downloaded the client library and trying out the first call to get campaign reports. I'm using the existing credentials that are working with ADWords API. 

I specified the MCC customer id inside ads.properties and the customer id associated with mcc account in the java call.  This did not work and I then tried all different combination of MCC customer id and customer id.  

Combinations include specifying the logincustomer id inside ads.properties file, with the mcc customer id, or a regular customer id belonging to that mcc account. And using either of the ids in the 
mvn exec:java -Dexec.mainClass="com.google.ads.googleads.examples.basicoperations.GetCampaigns"     -Dexec.args="--customerId xxxxxxxxxxx"
call.

I have checked that the client id, client secret, developerToken and refreshToken are set correctly for the specific MCC account inside the ads.properties file. Still I'm getting the same 401 error.

If you could help me debug this issue, it would be very much appreciated!


Thanks,
Sifang

Status: Status{code=UNAVAILABLE, description=Credentials failed to obtain metadata, cause=com.google.api.client.http.HttpResponseException: 401 Unauthorized
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1094)
at com.google.auth.oauth2.UserCredentials.refreshAccessToken(UserCredentials.java:193)
at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:165)
at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:151)
at com.google.auth.Credentials.blockingGetToCallback(Credentials.java:113)
at com.google.auth.Credentials$1.run(Credentials.java:99)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Google Ads API Forum Advisor Prod

unread,
Oct 3, 2019, 5:03:13 PM10/3/19
to sifan...@gmail.com, adwor...@googlegroups.com

Hello,

Thank you for reaching out. To better investigate your issue, could you please share the complete request and response logs along with the client customer id? Please use Reply privately to author option while sharing the details.

Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001UKM8VM:ref

Sifang Chu

unread,
Oct 7, 2019, 3:18:47 PM10/7/19
to AdWords API and Google Ads API Forum
Hi,

I have replied your message twice in the private mode. However, I cannot see any record of them from gmail nor the forum. Please confirm if you have received those messages or not.

Thanks,
Sifang

Google Ads API Forum Advisor Prod

unread,
Oct 8, 2019, 2:26:40 PM10/8/19
to sifan...@gmail.com, adwor...@googlegroups.com
Hi Sifang,

Yes, we received your message. Here is what Nikisha said in her last response:
Thank you for sharing the details. If you are requesting OAuth credentials from a manager account and are accessing a related customer account, you will need to set the login-customer-id header to the customer ID of the manager account, removing any hyphens in the Id and customer id in the request code. Could you please confirm if you are using the credentials associated with the login customer id to make API call? If yes, could you please share the email address used while generating Oauth credentials?

Regards,
Anthony
Google Ads API Team


ref:_00D1U1174p._5001UKM8VM:ref
Reply all
Reply to author
Forward
0 new messages