Hi Bosh,

Just to add to that (I am experiencing the exact same thing - script is 
similar), the issue is resolved on my side when I add the user (whose 
refresh token we are using) directly to the account (login-customer-id is 
left unchancged), but that is not a solution.  We can use the refresh token 
to successfully fetch the list of manager accounts (does not require the 
login-customer-id) but then the failure takes place on the ad account level 
(where we do add the login-customer-id). My next step is to try to map the 
hierarchy of the user access using something similar to this sample 
<https://developers.google.com/google-ads/api/docs/account-management/get-account-hierarchy>,
 
which may provide some more insight.

Thanks,

Moshik



On Monday, July 5, 2021 at 4:26:02 PM UTC+3 bos...@gmail.com wrote:

> Hi Ernie And Moshik
>
> Sorry to bother you both.
>
> I am having the same issue as Moshik.
> I have looked over the documentation and am still confused sorry.
>
> If I am using the python sdk and using the load_from_dict() method.
> By adding the login-customer-id and client _id to the dict credentials 
> will this work?
>
> here is a sample of my script below
> from google.ads.googleads.client import GoogleAdsClient
> from google.ads.googleads.errors import GoogleAdsException
>
>
>
> credentials = {
>     "developer_token": MCC DEVELOPER TOKEN,
>     "refresh_token": "xxxxxxx,
>     "client_secret": xxxxxx,
>     "login-customer-id" :MCC_ID,
>     "customer_id" : ACCOUNT_ID,
>     "access_token" : XXXXX'
>      }
> client = GoogleAdsClient.load_from_dict(credentials)
>
> The account sits under an mcc that sits under another mcc.
> which combination of developer token, mcc id for the login-customer-id 
> should I use?
>
> This all renders fine
>
> but when I then go on to execute rendering the report with the below code
>
> customer_id= ACCOUNT_ID
> ga_service = client.get_service("GoogleAdsService")
>
> query = """
>         SELECT
>           campaign.id,
>           campaign.name
>         FROM campaign
>         ORDER BY campaign.id"""
>
>     # Issues a search request using streaming.
> response = ga_service.search_stream(customer_id=customer_id, query=query )
>
> it always gives this error:
>   message: "User doesn\'t have permission to access customer. Note: If 
> you\'re accessing a client customer, the manager\'s customer id must be set 
> in the \'login-customer-id\' header. See 
> https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid";
>  
> }
>
> Apologies can u please elaborate some more.  
>
> For reference the oauth2 is working correctly and i have successfully 
> gotten the refresh token. The app type is desktop.
>
>
> Many thanks
>
> Bosh
>
>
> On Monday, July 5, 2021 at 7:59:27 PM UTC+10 adsapi wrote:
>
>> Hi Moshik,
>>
>> Thank you for raising your concern.
>>
>> You may refer to this document 
>> <https://developers.google.com/google-ads/api/docs/concepts/call-structure> 
>> as 
>> it discussed the structure of all API calls, especially this section 
>> <https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid>
>>  
>> as it explained what you need to set in the *login-customer-id* and where 
>> the user account / email address used to generate the Oauth2 credential 
>> should have access.​​​​​
>>
>> Regards,
>> [image: Google Logo] 
>> Ernie John Blanca Tacata 
>> Google Ads API Team 
>>   
>>
>> ref:_00D1U1174p._5004Q2JYa3Y:ref
>>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/1417c40d-c35f-4036-9e0f-f4628d87793dn%40googlegroups.com.

Reply via email to