Getting authenticated with Ads API v5 and service account

83 views
Skip to first unread message

Erik Møiniche-Kiebe

unread,
Sep 30, 2020, 7:34:46 AM9/30/20
to AdWords API and Google Ads API Forum
Hi I'm trying to get started with the Ads API v5 using a service account.. I'm familiar with the CM, DV360 and Analytics API, but somehow can't get Ads API to work.

I already have a service account working with the 3 above mentioned APIs. I'm enabled the Ads API and gotten a developer token.

When granting access to a service account is it the same procedure as ie. DV360, where you invite the email of the service acocunt to the Ads account?

To my understanding I have to put in the developer token in the google-ads.yaml file, which I've done. Also in the yaml file I've tried several login_customer_ids which should be tied to the customers account.

I'm using the Python client library and I've tried the sample script get_campaigns.py. No luck. Not even the get_account_hierarchy.py or list_accessible_clients.py work. What am I getting wrong?

Can someone explain the authentication setup to me like I'm five? The documentaion around v5 are pretty vague, and I really don't want to get started on the older Adwords API when starting fresh.

Google Ads API Forum Advisor Prod

unread,
Sep 30, 2020, 3:48:40 PM9/30/20
to erik....@dentsuaegis.com, adwor...@googlegroups.com

Hi Erik,

Thank you for reaching out. The service account email could not be invited to the Ads account. I would suggest you use the Installed Application Flow or the Web Application Flow to authenticate the account instead.

Thanks and regards,
Xiaoming, Google Ads API Team


Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q25Y1UP:ref

Erik Møiniche-Kiebe

unread,
Oct 1, 2020, 8:42:09 AM10/1/20
to AdWords API and Google Ads API Forum
Thanks for confirming that.. I did try the application flow in the end, and that worked. Just to understand and for future reference, why are service accounts mentioned in relations to the Ads API then, when it doesn't work?

When using the application flow to authenticate would the best practice be to grant access an email like adw...@mycompany.com and use that instead of my personal email? Just to make sure anything doesn't break if I were to leave the company and my email be deleted?

Thanks
Erik

Google Ads API Forum Advisor Prod

unread,
Oct 1, 2020, 3:55:20 PM10/1/20
to erik....@dentsuaegis.com, adwor...@googlegroups.com

Hi Erik,

Thank you for reaching out. We strongly recommend using installed app or web flows instead of service accounts unless you need domain-specific features. The service account flow is more complicated in configuration. Using the company email would be preferred over using the personal email.



Thanks and regards,
Xiaoming, Google Ads API Team


Pradnya Nanaware

unread,
Oct 26, 2020, 3:32:36 AM10/26/20
to AdWords API and Google Ads API Forum
hello Xiaoming,

Could you please link us to a guide or sample example of how to set up a service account to use with Google Ads and Adwords API.

Thanks,
Pradnya Nanaware

Google Ads API Forum Advisor Prod

unread,
Oct 26, 2020, 12:34:22 PM10/26/20
to adwor...@googlegroups.com

Hi Pradnya,

Thank you for reaching out. We recommend you use installed app or web flows. However, if you insist on using the service account please refer to this documentation for more information.



Thanks and regards,
Xiaoming, Google Ads API Team

Erik Møiniche-Kiebe

unread,
Oct 27, 2020, 3:22:07 AM10/27/20
to AdWords API and Google Ads API Forum
Hi Pradnya

Just a friendly advise.. Go with the recommendation from Xiaoming... I wasted so much time trying to get a service account to work.. took me 5 mins. after using installed app or web flows method.

Best regards
Erik Møiniche-Kiebe

Google Ads API Forum Advisor Prod

unread,
Oct 27, 2020, 11:43:53 AM10/27/20
to erik....@dentsuaegis.com, adwor...@googlegroups.com

Hi Erik,

Thank you for sharing your experience. Please don’t hesitate to let us know if you have any other questions.



Thanks and regards,
Xiaoming, Google Ads API Team
 

Reply all
Reply to author
Forward
0 new messages