Re: Extending invitations returns ManagedCustomerServiceError.NOT_AUTHORIZED error code

2018-05-17 Thread zemen
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

Il giorno mercoledì 16 maggio 2018 23:29:01 UTC+2, zemen ha scritto:
>
> 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 :)
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/ae3b2a92-c789-40eb-996c-2769dec6c95b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Extending invitations returns ManagedCustomerServiceError.NOT_AUTHORIZED error code

2018-05-18 Thread zemen
Hi Luis,

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

Thanks in advance,
zemen

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/55f23c20-353d-4104-bdc4-1a24c55836b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Extending invitations returns ManagedCustomerServiceError.NOT_AUTHORIZED error code

2018-05-16 Thread zemen
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 :)

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/16c0cf77-e286-420a-b802-d3f8007b2360%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.