Extending invitations returns ManagedCustomerServiceError.NOT_AUTHORIZED error code

85 views
Skip to first unread message

zemen

unread,
May 16, 2018, 5:29:01 PM5/16/18
to AdWords API and Google Ads API Forum
Hi,

I'm trying to link a customer to my MCC account through my website services.
Here the PHP code:
// Generate a refreshable OAuth2 credential for authentication.
$oAuth2Credential = (new OAuth2TokenBuilder())
    ->withClientId(self::MANAGER_CLIENT_ID)
    ->withClientSecret(self::MANAGER_CLIENT_SECRET)
    ->withRefreshToken(self::MANAGER_REFRESH_TOKEN)
    ->build();

// Construct an API session configured from a properties file and the OAuth2
// credentials above.
$session = (new AdWordsSessionBuilder())
    ->withOAuth2Credential($oAuth2Credential)
    ->withDeveloperToken(self::MANAGER_DEV_TOKEN)
    ->withClientCustomerId(self::MANAGER_CLIENT_CUSTOMER_ID)
    ->build();

$adWordsServices = new AdWordsServices();

/**
 * @var ManagedCustomerService $managedCustomerService
 */
$managedCustomerService = $adWordsServices->get($session, ManagedCustomerService::class);

$linkOp = new LinkOperation();
$link = new ManagedCustomerLink();

$link->setClientCustomerId(self::CLIENT_CID);
$link->setLinkStatus(LinkStatus::PENDING);
$link->setManagerCustomerId(self::MANAGER_CLIENT_CUSTOMER_ID);
$linkOp->setOperand($link);
$linkOp->setOperator(Operator::ADD);
$mutateLinkResults = $managedCustomerService->mutateLink([$linkOp]);
return $mutateLinkResults;

please help :)

Luis Xander Talag (AdWords API Team)

unread,
May 17, 2018, 12:04:34 AM5/17/18
to AdWords API and Google Ads API Forum
Hi Zemen,

To further investigate this, could you provide the complete SOAP request and response logs when you encountered the error? Also, could you provide your email address that is associated to your AdWords account? Please reply via Reply privately to author.

Thanks and regards,
Luis
AdWords API Team

zemen

unread,
May 17, 2018, 10:54:43 AM5/17/18
to AdWords API and Google Ads API Forum
Hi Luis,

my bad. The oauth token was created with access_type = online. So the token was expired.
Now everything is working as expected.

One more questione:
is there a way to turn off the email alert to the client account to be managed?

Thanks in advance

Luis Xander Talag (AdWords API Team)

unread,
May 17, 2018, 10:50:33 PM5/17/18
to AdWords API and Google Ads API Forum
Hi Zemen,

I'm glad that your issue has been resolved. Regarding the email alert, I believe you could configure that through the AdWords UI by navigating to Tools, billing, and settings icon  > Preferences > NOTIFICATIONS tab or if you are using the old UI, click the gear icon  > Account settings > Notifications Settings. Hope this helps.

zemen

unread,
May 18, 2018, 12:24:12 PM5/18/18
to AdWords API and Google Ads API Forum
Hi Luis,

it does not work.
What I mean was to stop receiving emails on MCC Extending invitation events.

Thanks in advance,
zemen

Dannison Yao (AdWords API Team)

unread,
May 21, 2018, 3:52:50 AM5/21/18
to AdWords API and Google Ads API Forum
Hi Zemen,

Allow me to assist you on your concern as Luis is on OOO today. If you are looking for a way to stop the emails sent by AdWords when extending invitation, unfortunately, there is no way of doing this in AdWords API.

Regards,
Dannison
AdWords API Team
Reply all
Reply to author
Forward
0 new messages