I'm trying to replace current manager 3191377543 with a new manager 
6762660391 on client 9801005090. I'm getting following error:

Fatal error: Uncaught Google\ApiCore\ApiException: { "message": "The caller 
does not have permission", "code": 7, "status": "PERMISSION_DENIED", 
"details": [ { "@type": 0, "data": 
"type.googleapis.com\/google.ads.googleads.v3.errors.GoogleAdsFailure" }, { 
"@type": 0, "data": [ { "errorCode": { "authorizationError": 
"AUTHORIZATION_ERROR" }, "message": "Authorization of the client failed." } 
] } ] } thrown in /home/dszomh/domains/app.datadriventool.com/public_html/
libraries/google-ads/vendor/google/gax/src/ApiException.php on line 139

My code:

namespace Google\Ads\GoogleAds\V3\Services\Gapic;


include($_SERVER['DOCUMENT_ROOT'].
'/libraries/google-ads/vendor/autoload.php');


use Google\Ads\GoogleAds\V3\Services\CustomerManagerLinkServiceClient;


use GetOpt\GetOpt;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentNames;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentParser;
use Google\Ads\GoogleAds\Lib\V3\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V3\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V3\GoogleAdsException;
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;
use Google\Ads\GoogleAds\V3\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V3\Resources\Customer;
use Google\ApiCore\ApiException;
use Google\Protobuf\BoolValue;
use Google\Protobuf\StringValue;


$refresh_token = '1//0c5B...';
$customerId = '9801005090';
$newManager = 'customers/6762660391';


$oAuth2Credential = (new OAuth2TokenBuilder())
->fromFile()
->withRefreshToken($refresh_token)
->build();


$googleAdsClient = (new GoogleAdsClientBuilder())->fromFile()->
withOAuth2Credential($oAuth2Credential)->build();


$customerManagerLinkServiceClient = $googleAdsClient->
getCustomerManagerLinkServiceClient();


try {


  $previousCustomerManagerLink = 
"customers/9801005090/customerManagerLinks/3191377543~182140507";


  $response = $customerManagerLinkServiceClient->moveManagerLink($customerId
, $previousCustomerManagerLink, $newManager);


  print_r($response);


} finally {


  $customerManagerLinkServiceClient->close();


}

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/cc50cecb-974e-4c69-89e4-d91339eac197o%40googlegroups.com.

Reply via email to