Hi Emona,
Thanks for reaching out. The error USER_PERMISSION_DENIED usually occurs when there is no link between the manager account authenticated in the request and the client account specified in the headers. Could you please make sure that the manager account you used to authenticate the call has administrative access to the client account you are calling against? If the issue persists, could you please send me the complete request and response logs along with the client customer id and the email you used to generate the OAuth2 credentials via Reply privately to the author option?
For the PHP library logging information, you can follow the instructions here.
Thanks,
Nirmita Patel Google Ads Team
[GOOGLE_ADS]
; Required AdWords API properties. Details can be found at:
; https://developers.google.com/adwords/api/docs/guides/basic-concepts#soap_and_xml
developerToken = "xxxxxxxxxxxxxxxxxxx"
clientCustomerId = "774-826-5171"
loginCustomerId = "266-371-1171"class GetTextAdRecommendations
{
private const CUSTOMER_ID = '3617418922';
private const PAGE_SIZE = 1000;
public static function main()
{
// Either pass the required parameters for this example on the command line, or insert them
// into the constants above.
$options = (new ArgumentParser())->parseCommandArguments([
ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT
]);
// Generate a refreshable OAuth2 credential for authentication.
$oAuth2Credential = (new OAuth2TokenBuilder())->fromFile('../Authentication/google_ads_php.ini')->build();
// Construct a Google Ads client configured from a properties file and the
// OAuth2 credentials above.
$googleAdsClient = (new GoogleAdsClientBuilder())
->fromFile('../Authentication/google_ads_php.ini')
->withOAuth2Credential($oAuth2Credential)
->build();
.......................