Getting ManagedCustomerServiceError.NOT_AUTHORIZED while linking client account

91 views
Skip to first unread message

develop...@gmail.com

unread,
Jan 16, 2018, 6:42:03 AM1/16/18
to AdWords API Forum
Hi,

I am trying to extend an invitation to client account from manager account through API, But i got the below mentioned error:

 Uncaught exception 'Google\AdsApi\AdWords\v201710\cm\ApiException' with message '[ManagedCustomerServiceError.NOT_AUTHORIZED @ operations[0]]' in /opt/lampp/htdocs/adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php:39 Stack trace: #0 /opt/lampp/htdocs/adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php(39): ReflectionClass->newInstanceArgs(Array) #1 /opt/lampp/htdocs/adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php(173): Google\AdsApi\Common\Util\Reflection->createInstance('Google\\AdsApi\\A...', '[ManagedCustome...') #2 /opt/lampp/htdocs/adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php(138): Google\AdsApi\Common\AdsSoapClient->parseApiExceptionFromSoapFault(Object(SoapFault)) #3 /opt/lampp/htdocs/adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/AdWords/v201710/mcm/ManagedCustomerService.php(185): Google\AdsApi\Common\AdsSoapClient->__soapCall('mutateLi in /..vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php on line 39

My code snippet is: (PHP)

 $managedCustomerService = $adWordsServices->get($session, ManagedCustomerService::class);
   
    $link = new ManagedCustomerLink();
    $link->setClientCustomerId(XXXXXXXXX);
    $link->setManagerCustomerId(XXXXXXXXXXX);
    $link->setLinkStatus(LinkStatus::PENDING);

    //$linkop->setOperand($link);
    //$linkop->setOperator(Operator::SET);
     
    $linkop = new LinkOperation();
    $linkop->setOperator(Operator::ADD);
    $linkop->setOperand($link);

    $operations[] = $linkop;
    $result = $managedCustomerService->mutateLink($operations);
Can you please suggest me how to rectify it so that i can invite clients to MCC account.

Regards,
Djax Developer.

Bharani Cherukuri (AdWords API Team)

unread,
Jan 16, 2018, 1:41:27 PM1/16/18
to AdWords API Forum
Hello, 

The NOT_AUTHORIZED error occurs when the user authenticating the request is not authorized to perform this operation. Only users with Administrative access can accept and reject manager account link requests. Could you check the access level of the email address used to generate the refresh token? If you still encounter the error with an administrative access, please enable logging and provide the SOAP request and response logs along with the email address used to generate the refresh token and I'll take a look. Please use Reply privately to author to share the details. 

Regards,
Bharani, AdWords API Team

Reply all
Reply to author
Forward
0 new messages