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:
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
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?