List accessible accounts with test developer token

89 views
Skip to first unread message

Kateřina Henzlová

unread,
Jul 22, 2021, 9:08:57 AM7/22/21
to AdWords API and Google Ads API Forum
Hi there!

I use the Google Ads java library. I need to list all Google Ads accounts that a certain Google user can access (directly or indirectly). For the directly accessible accounts, I can use List Accessible Accounts.

For the accounts that can be accessed via manager account, I can use the GoogleAdsServiceClient.search() with some query like "SELECT customer_client.client_customer, customer_client.descriptive_name, customer_client.id FROM customer_client WHERE customer_client.level <= 1" similar to Get Account Hierarchy.

With the production token, everything works as expected. The problem is when I use our test developer token which can only be used with testing Google Ads accounts. "List Accessible Accounts" returns all accessible accounts, both for testing, and production. Then, when I try the Search request with one of the production accounts, I get an error "authorization_error: DEVELOPER_TOKEN_NOT_APPROVED,  message: "The developer token is not approved. Non-approved developer tokens can only be used with test accounts."". "List Accessible accounts" response doesn't contain the information if the account is testing or not. Get Customer results in the same error when I try with a production account.

Is there any way to list all accounts accessible by a user with a test developer token?

Thanks,
Katerina

Google Ads API Forum Advisor

unread,
Jul 22, 2021, 11:10:46 PM7/22/21
to adwor...@googlegroups.com

Hi Katerina,

Thanks for reaching out to us.

It appears that you received the DEVELOPER_TOKEN_NOT_APPROVED when you tried to access the production accounts with the test account access. It is intended to get the error DEVELOPER_TOKEN_NOT_APPROVED, since you would need to request for at least a basic access level for your developer token if you would be making calls to your production Google Ads accounts. 

You can’t use the test developer token to list all the production accounts. For this I suggest you use a production developer token holding at least a basic access level. 

Let us know if you have any further questions.

Regards,
 

Google Logo
Yasar Ramjan Makandar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2JCpWM:ref

Kateřina Henzlová

unread,
Jul 23, 2021, 4:44:10 AM7/23/21
to AdWords API and Google Ads API Forum
Hi Yasar,

Thanks for your reply. I'm afraid there was a misunderstanding. I don't need to list production accounts with a test developer token. What I'd like to do is to list all accessible test accounts. At the moment, this is not possible because the method "List Accessible accounts" lists all account IDs including production accounts. Then, when I want to fetch account detail, I get an error when accessing production accounts. It seems like there's no way to find out which account is testing and which is for production to avoid this exception.

Best regards,
Katerina

Google Ads API Forum Advisor

unread,
Jul 26, 2021, 4:20:55 PM7/26/21
to adwor...@googlegroups.com
Hi Kateřina,

I work with Yasar and will assist you. The Ads API attempts to mirror the functionality of the UI. Is there a list or report in the UI that shows which accounts are or aren't test accounts? If so, could you send us privately a screenshot? Alternatively, you may send publicly a screenshot without personal information.

Regards,

Google Logo
Aryeh Baker
Google Ads API Team
 


ref:_00D1U1174p._5004Q2JCpWM:ref

Kateřina Henzlová

unread,
Jul 29, 2021, 6:55:42 AM7/29/21
to AdWords API and Google Ads API Forum
Hey Aryeh,

Thanks for looking into it. After signing in, I'm shown a list of all my accounts, and the information on whether the account is testing or not is shown later.screenshot-accounts-list.pngscreenshot-test-account.png

The first screen (list account IDs and names) wouldn't be possible with the test developer token. I can fetch all accessible accounts IDs (both testing and production) but when I try to fetch account info (name) for every account, the request fails for production accounts. I believe the production account IDs should not be listed with test developer tokens.

Best regards,
Katerina

Google Ads API Forum Advisor

unread,
Jul 30, 2021, 1:19:14 AM7/30/21
to adwor...@googlegroups.com
Hi Katerina,

I'm also from the AdWords / Google Ads API support team and allow me to assist you as well.

Regarding your concern "I believe the production account IDs should not be listed with test developer tokens.", could you confirm if what you meant is that, the Google Ads API should not list the production account IDs along with the test account IDs in the results of the list accessible accounts request? If yes, then it appears that the functionality works as intended, to list the Google Ads accounts where your user or email address has access to.

To avoid mixing the test and production accounts in the response, we recommend that you associate a different user / email address depending on which environment the account was intended for.

This way, if for example, user_pr...@yourdomain.com has access only to production accounts, then using the OAuth2 credentials generated by this user in the listAccessibleAccounts request, should only return production accounts. The same applies if for example a user...@yourdomain.com has access to only test accounts.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


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