Hi guys,
In one of my projects, I am trying to link a Manager account with a 
customer (My account) account but it throws following error:
Fatal error: Uncaught exception 
'Google\AdsApi\AdWords\v201705\cm\ApiException' with message 
'[ManagedCustomerServiceError.NOT_AUTHORIZED @ operations[0]]

I have manager account id 9663159860 and customerId 6694378287. In the 
first step, I am taking refresh token by following oauth2 steps and getting 
the customer ID. After that, I am passing the customerID in 
ManagedCustomerLink object but when I try to use mutateLink it throws the 
above error. Here is the code below which I have used assuming I have 
already set the refresh token of customer in ini file.

public static function runExample(AdWordsServices $adWordsServices,
AdWordsSession $session) {
//$campaignService = $adWordsServices->get($session, 
CampaignService::class);
$managedCustomerService = $adWordsServices->get($session, 
ManagedCustomerService::class);

$customer = new ManagedCustomerLink();
$customer->setManagerCustomerId("9663159860");
$customer->setClientCustomerId("6694378287");
$customer->setLinkStatus("PENDING");
 

// Create operation.
$operation = new LinkOperation();
$operation->setOperand($customer); 
$operation->setOperator("ADD"); 

 
//$operation->OperationType = $OperationType;

$operations = array($operation);

echo '<pre>';
print_r($operations);

// Make the mutate request.
$result = $managedCustomerService->mutateLink($operations);

print_r($result);
exit;
}

I would appreciate anyone's help as I am stuck for several hours here.


Thanks,
Amrender

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/60ce4be8-b992-41b6-a504-bc6777d7a570%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to