With the "Google Ads API" - PHP Client Library.

While calling the "GetCampaigns.php" / "ListAccessibleCustomers.php" example code. I was still getting this error (below) but found a solution (check answer).

Error -

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

Tag:google-ads-api, php, google-oauth

Only one comment.

  1. K-G

    Fix -

    Pass the Manager account's ID (in my case test manager account) = $loginCustomerId

    ->withLoginCustomerId($loginCustomerId)

    So in the “GoogleAdsClientBuilder” -

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

Add a new comment.