When using a service account to authorize advertising accounts and obtain advertising data, the interface reported an error

53 views
Skip to first unread message

xilibanzhuan

unread,
Sep 8, 2023, 11:58:35 PM9/8/23
to Google Ads API and AdWords API Forum

 Hello, our company has several Google Advertising accounts and we would like to develop a Google Advertising application,

Due to the complexity and complexity of the operations required to release official applications and complete account authorization within the Google system,

And we only need to obtain advertising report data for internal advertising accounts. Simply authorize the advertising account to the application through a simple method.

So I want to obtain authorization through the "Service Account" method to retrieve data.

My approach is to create a developer's "service account" using an advertising manager account that has successfully registered the application (we name it "advertising account=A", email="A", MMC="A").【I have uploaded my advertising account as administrator under this case】

Multiple advertising accounts B (we named it "Advertising Account=B", Email="B", MMC="B") and C (we named it "Advertising Account=C", Email="C", MMC="C") in our company have been granted maximum administrator privileges to Advertising Account A.

Then I use the "GetCampaigns" interface in the developer library to obtain all advertisements under the advertising account "MMC=343-269-7321"
The error reported is:{"errors":[{"errorCode":{"authenticationError":"NOT_ADS_USER"},"message":"User in the cookie is not a valid Ads user."}],"requestId":"8NdqAKbasJjqkFfGMrvWZQ"}


Question 1:
I know that I should actually add advertising account B and advertising account C to the organizational structure of my Google cloud, and use them to create a "service account". Use the service account they create to complete authorization and pull data. However, due to the large number of advertising accounts and websites in our company, we initially registered using different websites and corporate email suffixes. Therefore, I am unable to pull these other advertising accounts into my organizational structure and directly create service accounts using them. (The following figure is a screenshot of adding as an administrator)

May I ask if I can obtain authorization for these advertising accounts using the service account method now (by adding my service account and email number as the highest authorized administrator in other advertising accounts)?

If not, are there any other faster ways to complete account authorization?


Question 2:
Is there an error in the code when I initiated an interface request? If so, how can I initiate it

Thank you for your patience and professionalism 


Set as admin.png

Google Ads API Forum Advisor

unread,
Sep 11, 2023, 6:08:38 AM9/11/23
to yuanp...@gmail.com, adwor...@googlegroups.com

Hi,

 

Thank you for reaching out to the Google Ads API team.

 

To clarify, Service Account is an account that belongs to your app instead of to an individual end user. Service accounts enable server-to-server interactions between a web app and a Google service. Your app calls Google APIs on behalf of the service account, so users aren't directly involved.

 

If you are having troubles authenticating using a service account, kindly refer to the OAuth Service Account Flow documentation for the Client library you are using. Here's the sample for JAVA library: https://developers.google.com/google-ads/api/docs/client-libs/java/oauth-service. You can also check our Authorization documentation for Service accounts.

 

For your second concern, can you clarify what error you encountered? You can provide us with the Complete request and response logs with the request-id in text format. You can enable logging, refer to the Logging documentation of your library (JAVA sample: https://developers.google.com/google-ads/api/docs/client-libs/java/logging) For errors encountered within the Google Ads UI, you can reach out to the Google Ads Product support team.


You may send it privately via the reply to author option. If this option is not available on your end, you may send it through our email (googleadsa...@google.com) instead.
 

Looking forward to your response.
 

This message is in relation to case "ref:_00D1U1174p._5004Q2ojkXU:ref"

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages