ManagedCustomerServiceError.NOT_AUTHORIZED @ operations[0]

192 views
Skip to first unread message

Christine Cameron

unread,
Aug 29, 2019, 6:43:07 PM8/29/19
to AdWords API and Google Ads API Forum

Hello

I' currently working on a project wherein we need to grant access from a Client Account to our Manage Account using the code below

 $managedCustomerService = $adWordsServices->get(
            $session,
            ManagedCustomerService::class
        );

        $link = new ManagedCustomerLink();
        $link->setManagerCustomerId('xxxxxxxxxx');
        $link->setClientCustomerId(''xxxxxxxxxx');
        $link->setLinkStatus(LinkStatus::PENDING);

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

        $operations = array($linkop);

        $result = $managedCustomerService->mutateLink($operations);

and resulting to an error

ManagedCustomerServiceError.NOT_AUTHORIZED @ operations[0]

both of the accounts are TEST accounts and I've been dealing for this problem for 2 days already. I've tried to check post about this problem but got no luck fixing this issue.

Google Ads API Forum Advisor Prod

unread,
Aug 29, 2019, 11:13:51 PM8/29/19
to adwor...@googlegroups.com
Hi Christine,

Thank you for posting your concern.

The NOT_AUTHORIZED error occurs when the user authenticating the request is not authorized to perform this operation. Only the users with Administrative access can add new account. With this, could you check the access level of the email address used to generate the OAuth2 credential? 

You should be able to login in your manager account and navigate to the TOOLS & SETTINGS > SETUP > Account access > USERS tab. This will contain user's email address with their access level. If you can confirm that your access is 'administrative' and you are still encountering this error, could you provide the CID and the login user email you've used in API call via Reply privately to author option so that I can take a closer look?

Regards,
Ejay
Google Ads API Team

ref:_00D1U1174p._5001UHF9g1:ref
Reply all
Reply to author
Forward
0 new messages