USER_PERMISSION_DENIED for the new Ads API with the java SDK

25 views
Skip to first unread message

Julián Canada Racinet

unread,
Jul 8, 2019, 6:36:45 AM7/8/19
to AdWords API and Google Ads API Forum
Hi all!
 
We are having issues in production the new GoogleAds API. We are using the java sdk. This approach works for some customers but not for others (we are not yet using the MCC account)
When trying to retrieve data, we first create the client:

            Credentials creds = UserCredentials.newBuilder()
                    .setClientId(myCredentials.clientId)
                    .setClientSecret(myCredentials.clientSecret)
                    .setRefreshToken(myCredentials.getRefreshToken)
                    .build();

            googleAdsClient = GoogleAdsClient.newBuilder()
                    .setCredentials(creds)
                    .setDeveloperToken(
myCredentials.developerToken).build();

And when we try to query the GoogleAdsClient, we get USER_PERMISSION_DENIED error (for example, request-id=WGaViBiCTnaPpgijuPi4lg). 

This approach works for some accounts but not for some others. An important thing to notice is that those failing log in attemps do work for the adwords axis java sdk using the same credentials.

We tried with the oauthdoctor but couldn't connect either. 

I've saved the complete log if you want me to share privately.

Thank you!

Google Ads API Forum Advisor Prod

unread,
Jul 8, 2019, 2:45:00 PM7/8/19
to jul...@gmail.com, adwor...@googlegroups.com
Hi Julián, 

The USER_PERMISSION_DENIED error occurs when the account is not linked to an MCC that can directly manage accounts. Another possible reason is that the OAuth2 credentials used has no access to the specific client account. Could you please make sure that you're generating the OAuth credentials by logging in as a user who has access to the Google Ads account? If you're generating the 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 that manager account, removing any hyphens in the ID. If you're still seeing an issue, could you please share the email address used for authentication along with the error logs using Reply privately to author option, so I can take a look? 

Thanks,
Bharani, Google Ads API Team
 

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