This question is a cross-post of an issue 
<https://github.com/googleads/google-ads-php/issues/264> on the Github 
googleads/google-ads-php 
library <https://github.com/googleads/google-ads-php>, I was told to follow 
up here for more help.


I am working to get a product integrated with the Google Ads Conversion 
Actions <https://developers.google.com/google-ads/api/docs/conversions>. We 
are attempting to add new conversion actions via the Google Ads API (v2). 
We have followed the instructions for such an action, as documented here 
<https://developers.google.com/google-ads/api/docs/samples/add-conversion-action#php>
.


Of course our code looks a little different, so here is an excerpt of it:

// An oAuth token previously obtained. We do have a refresh token. 
// This token has been granted the following scope: 
// https://www.googleapis.com/auth/adwords 
// as documented at: 
// https://developers.google.com/adwords/api/docs/guides/authentication 
$oAuth2Credential = (new OAuth2TokenBuilder()) 
  ->withClientId('REDACTED') 
  ->withClientSecret('REDACTED') 
  ->withRefreshToken('REDACTED') 
  ->build(); 

// The ID of the client website 
// The user granting us their oAuth token has full access to this property 
// Our MCC account also has full permissions for this account for good measure
$customerId = 'xxx-xxx-xxxx'; 

$googleAdsClient = (new GoogleAdsClientBuilder()) 

  // This developer token was obtained from our MCC account, as documented 
here: 
  // https://developers.google.com/google-ads/api/docs/first-call/dev-token 
  ->withDeveloperToken('REDACTED') 
  ->withLoginCustomerId($customerId) 

  ->withOAuth2Credential($oAuth2Credential) 
  ->build(); 

// Just setting up a test conversion action
$conversionAction = (new ConversionAction()) 
  ->setName((new StringValue())->setValue('TEST LABEL')) 
  ->setCategory(ConversionActionCategory::PBDEFAULT) 
  ->setType(ConversionActionType::WEBPAGE) 
  ->setStatus(ConversionActionStatus::ENABLED) 
  ->setValueSettings( 
    (new ValueSettings()) 
      ->setAlwaysUseDefaultValue((new BoolValue())->setValue(true)) 
      ->setDefaultValue((new DoubleValue())->setValue(0.0)) 
  ); 

// Issues a mutate request to add the conversion action. 
$conversionActionServiceClient = 
$googleAdsClient->getConversionActionServiceClient(); 
$response = $conversionActionServiceClient->mutateConversionActions( 
  $customerId, [(new 
ConversionActionOperation())->setCreate($conversionAction)] 
); 
// That causes the exception we are seeing

At that last function call, we get an authentication exception that looks 
like this:


Google\ApiCore\ApiException : { 
  "message": "Request had insufficient authentication scopes.", 
  "code": 7, 
  "status": 
  "PERMISSION_DENIED", 
  "details": [] 
}

 Now as far as we can tell, all the pieces are properly authorized. Any 
pointers? Anything obvious we are doing wrong?

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/ff15125c-b248-4ae8-b8bf-5976d5782f38%40googlegroups.com.

Reply via email to