Hello, I try to connect into my adwords account using the googleads/google-ads-php library. I'm capable to get a token and this token has the adwords scope but, when I try to get campaigns I get a PERMISSION_DENIED exception.
Google Ads failure details: authorization_error: User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer id must be set in the 'login-customer-id' header. See https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid I put my login-customer-id in my client like that: $oAuthCredential = (new OAuth2TokenBuilder()) ->withClientId($options->getClientId()) ->withClientSecret($options->getClientSecret()) ->withRefreshToken($options->getRefreshToken()) ->build(); $client = (new GoogleAdsClientBuilder()) ->withDeveloperToken($options->getDeveloperToken()) ->withOAuth2Credential($oAuth2Credential) ->withLoginCustomerId($loginCustomerId) ->build(); Where $loginCustomerId is my googleads MCC ID. I get this when I login with my googleads account (same email where I have my client) and select an account. I put this number without dashes. And when I try to get campaigns I do this: $stream = $client->getGoogleAdsServiceClient() ->searchStream($this->gaOptions->getCustomerId(), $query); $stream->iterateAllElements(); Where customerId is the ID of my account inside my MCC wihtout dashes. But then I get that PERMISSION_DENIED. I'm using the V6 versión of the googleads/google-ads-php. This is the highest I can use because some dependencies. My code is based in https://github.com/googleads/google-ads-php/blob/master/examples/BasicOperations/GetCampaigns.php I see requests in Google Cloud Console but always with a 4XX code. I think is an error in the way I put my loginCustomerId and/or customerId, but I cannot find the reason why. ¿Do I need add something to my oAuthCredential or GoogleAdsClient? ¿Could be I using this IDs in the wrong way? Thanks -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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/6b6a2735-b143-45ed-b7c0-a7c7d015b734n%40googlegroups.com.
