authorization_error: User doesn't have permission to access customer

2022-04-27 Thread Miguel Angel Calleja
Hi
PHP 8
Google Ads V9 => 13.0.0

Im getting the Customer Manager Links from my account 6765096429:

Array
(
[resource_name] => 
customers/6765096429/customerManagerLinks/2508518472~216663108
[status] => ACTIVE
[manager_customer] => customers/2508518472
[manager_link_id] => 216663108
)

At the next step I want to query the Customer Client "customers/2508518472" 
to get their descriptiveName but I receive an authorization error:

authorization_error: 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

Im passsing the customer 6765096429 like customer_login_id in the 
credentials:

$oAuth2Credential = (new OAuth2TokenBuilder())
->withClientId($client_id)
->withClientSecret($secret)
->withRefreshToken($refresh_token)
->build();

$googleAdsClient = (new GoogleAdsClientBuilder())
->withDeveloperToken($developer_token)
->withOAuth2Credential($oAuth2Credential)
->withLoginCustomerId(6765096429)
->build();

// Here, I query customer client 2508518472 to get the descriptiveName
$customerId=2508518472;
$query = 'SELECT customer_client.client_customer, customer_client.level,'
. ' customer_client.manager, customer_client.descriptive_name,'
. ' customer_client.currency_code, 
customer_client.time_zone,customer_client.test_account,'
. ' customer_client.id FROM customer_client 
limit 1';
$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();
$customer = $googleAdsServiceClient->search($customerId, 
$query)->getIterator()->current()->getCustomerClient();

print "name: ".$customer->getDescriptiveName();

At this point I receive the authorization_error

What am I doing wrong?

Best regards




-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords 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/fcb5e917-1e88-4d21-8249-aed321467f4dn%40googlegroups.com.


Re: Migration to v201603 error

2016-07-11 Thread Miguel Angel Calleja
I was instantiating ReportUtlis with an old version from v201509

I've fix it in v201605:

$reportUtils = new ReportUtils();
$reportUtils->DownloadReport($reportDefinition, $filePath, $user, $options);

And now it works! 

Thx

El viernes, 8 de julio de 2016, 20:37:11 (UTC+2), Thanet Knack 
Praneenararat (AdWords API Team) escribió:
>
> Hi Miguel,
>
> I'm not sure that with your settings, have you done *require_once* of 
> *AdsUtilityRegistry 
> *as done in our ReportUtils 
> <https://github.com/googleads/googleads-php-lib/blob/master/src/Google/Api/Ads/AdWords/Util/v201605/ReportUtils.php#L26>
> ?
> If you're still faced with the issue, could you please send your full 
> source code?
> (If it's private, please send by *Reply to author privately*)
>
> Best,
> Thanet, AdWords API Team
>
> On Saturday, July 9, 2016 at 2:19:38 AM UTC+9, Miguel Angel Calleja wrote:
>>
>> I have the same problem... I had to require ReportUtils.php but I get an 
>> other error:
>>
>>
>> PHP Notice:  Undefined property: importar_adwords::$adsUtilityRegistry in 
>> /mnt/webapps/trunk/lib/googleapi/googleads-php-lib-10.0.0/src/Google/Api/Ads/AdWords/Util/v201605/ReportUtils.php
>>  
>> on line 77
>>
>> Any idea?
>>
>> Php Version 5.5.26
>> Api version: 10.0.0
>>
>>
>> define('GOOGLE_API_PATH','/mnt/webapps/lib/googleapi/googleads-php-lib-10.0.0/src/');
>>
>> define('LIB_PATH', GOOGLE_API_PATH.'Google/Api/Ads/AdWords/Lib');
>> define('UTIL_PATH', GOOGLE_API_PATH.'Google/Api/Ads/Common/Util');
>> define('ADWORDS_UTIL_PATH', 
>> GOOGLE_API_PATH.'Google/Api/Ads/AdWords/Util');
>> define('ADWORDS_UTIL_VERSION_PATH', 
>> GOOGLE_API_PATH.'Google/Api/Ads/AdWords/Util/v201605');
>>
>> define('ADWORDS_VERSION', 'v201605');
>>
>> ini_set('include_path', implode(array(
>> ini_get('include_path'), PATH_SEPARATOR, GOOGLE_API_PATH
>> )));
>>
>>
>> require_once LIB_PATH.'/AdWordsUser.php';
>> require_once ADWORDS_UTIL_VERSION_PATH . '/ReportUtils.php';
>>
>>
>> 
>>
>> $user->LoadService('ReportDefinitionService', ADWORDS_VERSION);
>>
>> // Create selector.
>> $selector = new Selector();
>>
>>
>> El lunes, 20 de junio de 2016, 6:22:56 (UTC+2), Thanet Knack 
>> Praneenararat (AdWords API Team) escribió:
>>>
>>> Hi Oshua,
>>>
>>> What version of API and version of PHP lib you use (I guess the latter 
>>> to be 10.0.0)?
>>> What errors  did you get?
>>> I'm not sure why you have to make such a modification.
>>>
>>> Best,
>>> Thanet, AdWords API Team
>>>
>>> On Monday, June 20, 2016 at 12:30:58 PM UTC+9, Oshua Moreno wrote:
>>>>
>>>> I had the same issue with the reports. In my case I had to require 
>>>> ReportUtils.php and to make a small change on ReportUtils.php to get the 
>>>> instance of AdsUtilityRegistry like below:
>>>>
>>>> Added a new method on the class
>>>>
>>>> public function getAdsUtilityRegistry(){
>>>>   if (!$this->adsUtilityRegistry instanceof AdsUtilityRegistry){
>>>>   $this->adsUtilityRegistry = AdsUtilityRegistry::getInstance();
>>>>   }
>>>>   return $this->adsUtilityRegistry;
>>>>   }
>>>>
>>>> Change elsewhere references like
>>>>
>>>>
>>>> $this->adsUtilityRegistry->addUtility(
>>>>
>>>> to
>>>>
>>>> self::getAdsUtilityRegistry()->addUtility(...
>>>>
>>>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/763a0194-9086-4ff6-bd44-cbf307caa010%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migration to v201603 error

2016-07-08 Thread Miguel Angel Calleja
I have the same problem... I had to require ReportUtils.php but I get an 
other error:


PHP Notice:  Undefined property: importar_adwords::$adsUtilityRegistry in 
/mnt/webapps/trunk/lib/googleapi/googleads-php-lib-10.0.0/src/Google/Api/Ads/AdWords/Util/v201605/ReportUtils.php
 
on line 77

Any idea?

Php Version 5.5.26
Api version: 10.0.0

define('GOOGLE_API_PATH','/mnt/webapps/lib/googleapi/googleads-php-lib-10.0.0/src/');

define('LIB_PATH', GOOGLE_API_PATH.'Google/Api/Ads/AdWords/Lib');
define('UTIL_PATH', GOOGLE_API_PATH.'Google/Api/Ads/Common/Util');
define('ADWORDS_UTIL_PATH', GOOGLE_API_PATH.'Google/Api/Ads/AdWords/Util');
define('ADWORDS_UTIL_VERSION_PATH', 
GOOGLE_API_PATH.'Google/Api/Ads/AdWords/Util/v201605');

define('ADWORDS_VERSION', 'v201605');

ini_set('include_path', implode(array(
ini_get('include_path'), PATH_SEPARATOR, GOOGLE_API_PATH
)));


require_once LIB_PATH.'/AdWordsUser.php';
require_once ADWORDS_UTIL_VERSION_PATH . '/ReportUtils.php';




$user->LoadService('ReportDefinitionService', ADWORDS_VERSION);

// Create selector.
$selector = new Selector();


El lunes, 20 de junio de 2016, 6:22:56 (UTC+2), Thanet Knack Praneenararat 
(AdWords API Team) escribió:
>
> Hi Oshua,
>
> What version of API and version of PHP lib you use (I guess the latter to 
> be 10.0.0)?
> What errors  did you get?
> I'm not sure why you have to make such a modification.
>
> Best,
> Thanet, AdWords API Team
>
> On Monday, June 20, 2016 at 12:30:58 PM UTC+9, Oshua Moreno wrote:
>>
>> I had the same issue with the reports. In my case I had to require 
>> ReportUtils.php and to make a small change on ReportUtils.php to get the 
>> instance of AdsUtilityRegistry like below:
>>
>> Added a new method on the class
>>
>> public function getAdsUtilityRegistry(){
>>   if (!$this->adsUtilityRegistry instanceof AdsUtilityRegistry){
>>   $this->adsUtilityRegistry = AdsUtilityRegistry::getInstance();
>>   }
>>   return $this->adsUtilityRegistry;
>>   }
>>
>> Change elsewhere references like
>>
>>
>> $this->adsUtilityRegistry->addUtility(
>>
>> to
>>
>> self::getAdsUtilityRegistry()->addUtility(...
>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/c4848d15-6e4a-4669-a353-e8c445374774%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.