googleads / googleads-dfa-reporting-samples

Samples for the DoubleClick for Advertisers Reporting and Trafficking API
Apache License 2.0
106 stars 173 forks source link

Getting an authorization error while trying to get list of advertiser #109

Open MrugankMJ opened 2 months ago

MrugankMJ commented 2 months ago

We want to explore API route to get data from campaign manager portal.

  1. Created API Client - Downloaded creds json and enabled campaign manager API.
  2. Authenticated the user using authenticate_using_user_account.py
  3. Tried running - get_advertiser.py using the profile ID that has admin level access in CM360.

Also this works on API Explorer on the official documentation.

PS: I am downloading the files that I need locally and triggering the code.

Error Log

Traceback (most recent call last): File "get_advertisers.py", line 67, in main(sys.argv) File "get_advertisers.py", line 50, in main response = request.execute() File "C:\Users\g696150\PycharmProjects\Mrugank_Testpad\venv\lib\site-packages\googleapiclient_helpers.py", line 130, in positional_wrapper return wrapped(*args, **kwargs) File "C:\Users\g696150\PycharmProjects\Mrugank_Testpad\venv\lib\site-packages\googleapiclient\http.py", line 938, in execute raise HttpError(resp, content, uri=self.uri) googleapiclient.errors.HttpError: <HttpError 403 when requesting https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/1822640/advertisers?alt=json returned "Request had insufficient authentication scopes.". Details: "[{'message': 'Insufficient Permission', 'domain': 'global', 'reason': 'insufficientPermissions'}]">