Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to check if the service account is connected/invited to the someone else Google Ads? #541

Closed
dendihandian opened this issue Feb 26, 2024 · 1 comment

Comments

@dendihandian
Copy link

I have this code:

from googleads import ad_manager
from googleads import oauth2

oauth2_client           = oauth2.GoogleServiceAccountClient('./path-to-the-service-account-file.json', oauth2.GetAPIScope('ad_manager'))
ad_manager_client   = ad_manager.AdManagerClient(oauth2_client=oauth2_client, application_name='my_application_name')

when I list the networks with this, it returns empty list:

    networks = ad_manager_client.GetService('NetworkService').getAllNetworks()
    for network in networks:
        print('Network with network code "%s" and display name "%s" was found.' % (network['networkCode'], network['displayName']))

I'm pretty sure the my service account email is already connected/invited to the google ads manager. How to find out if it's connected in programmatically?

@christopherseeley
Copy link
Member

The method you're calling is the correct way to determine access programmatically. Note that service accounts must be added directly in the network settings page, not invited:
https://support.google.com/admanager/answer/6078734?

You can check the network's users in the UI and filter on "Service account" to determine if the service account was directly added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants