I am trying to send an invite to link and account with our MCC account. I 
keep getting [ManagedCustomerServiceError.NOT_AUTHORIZED @ operations[0]] 
error when i try to send invite.
The developer token with client id was created by a user with admin access. 
Also the user of the account that has been oauth that we are trying to link 
also has admin access.

This is the code im using to send the link
$linkOperation = new LinkOperation();
$managedCustomerLink = new ManagedCustomerLink();
$managedCustomerLink->setClientCustomerId($clientAdwordsId);
$managedCustomerLink->setLinkStatus(LinkStatus::PENDING);
$managedCustomerLink->setManagerCustomerId($managerAdwordsId);
$linkOperation->setOperand($managedCustomerLink);
$linkOperation->setOperator(Operator::ADD);
$session = $this->getAdWordsSession();
$adWordsServices = new AdWordsServices();
/** @var  ManagedCustomerService $adService */
$adService = $adWordsServices->get($session, ManagedCustomerService::class);
$response = $adService->mutateLink([$linkOperation]);

This is the xml we are sending to google with credentials stripped out
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201806"; 
xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201806";>
   <SOAP-ENV:Header>
      <ns2:RequestHeader>
         <ns1:clientCustomerId>XXX-XXX-XXXX</ns1:clientCustomerId>
         <ns1:developerToken>XXXXXXXXXXX</ns1:developerToken>
         <ns1:userAgent>SandO (AwApi-PHP, googleads-php-lib/35.2.0, 
PHP/5.6.14-1+deb.sury.org~trusty+1)</ns1:userAgent>
         <ns1:validateOnly>false</ns1:validateOnly>
         <ns1:partialFailure>false</ns1:partialFailure>
      </ns2:RequestHeader>
   </SOAP-ENV:Header>
   <SOAP-ENV:Body>
      <ns2:mutateLink>
         <ns2:operations>
            <ns1:operator>ADD</ns1:operator>
            <ns2:operand>
               <ns2:managerCustomerId>XXXXXXXXX</ns2:managerCustomerId>
               <ns2:clientCustomerId>XXXXXXXXXX</ns2:clientCustomerId>
               <ns2:linkStatus>PENDING</ns2:linkStatus>
            </ns2:operand>
         </ns2:operations>
      </ns2:mutateLink>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


This is the response we get back from google
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
   <soap:Header>
      <ns2:ResponseHeader 
xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201806"; 
xmlns="https://adwords.google.com/api/adwords/cm/v201806";>
         <requestId>00056fc8e30c69280ac155ea820d4bcd</requestId>
         <serviceName>ManagedCustomerService</serviceName>
         <methodName>mutateLink</methodName>
         <operations>1</operations>
         <responseTime>192</responseTime>
      </ns2:ResponseHeader>
   </soap:Header>
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>[ManagedCustomerServiceError.NOT_AUTHORIZED @ 
operations[0]]</faultstring>
         <detail>
            <ns2:ApiExceptionFault 
xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201806"; 
xmlns="https://adwords.google.com/api/adwords/cm/v201806";>
               <message>[ManagedCustomerServiceError.NOT_AUTHORIZED @ 
operations[0]]</message>
               
<ApplicationException.Type>ApiException</ApplicationException.Type>
               <errors 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:type="ns2:ManagedCustomerServiceError">
                  <fieldPath>operations[0]</fieldPath>
                  <fieldPathElements>
                     <field>operations</field>
                     <index>0</index>
                  </fieldPathElements>
                  <trigger />
                  
<errorString>ManagedCustomerServiceError.NOT_AUTHORIZED</errorString>
                  <ApiError.Type>ManagedCustomerServiceError</ApiError.Type>
                  <ns2:reason>NOT_AUTHORIZED</ns2:reason>
               </errors>
            </ns2:ApiExceptionFault>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>


Any ideas on how I can get past this error
Thanks

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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.
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/b9c324bb-a413-4d9d-aecf-473848dc6385%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to