Access issue

58 views
Skip to first unread message

Alexey

unread,
Jan 29, 2021, 3:40:02 AM1/29/21
to AdWords API and Google Ads API Forum
Hello. I have google account ads account and g-suite account. On g-suite account I have app to read ads data. I share ads customers from ads account to g-suite account, but when I'm trying to get these customers data I get access error.

When I filled out the form for developer token I received something like this:
"The company you applied for already has an approved API token through their Ads Manager (MCC) account ID {id}. in accordance with the Ads API policy, we provide only one developer token per legal entity. If you would like to receive contact information for a party with an already approved developer token, please reply to this email indicating this."

I'm usind php SDK GoogleAds V5 and getting all clients with this methods:

$this->client = (new GoogleAdsClientBuilder())
->fromFile(config('google_ads.config_file'))
->withOAuth2Credential((new OAuth2TokenBuilder())
->fromFile(config('google_ads.config_file'))
->withRefreshToken($token)
->build())
->build();
...
$customerServiceClient = $this->client->getCustomerServiceClient();
$accessibleCustomers = $customerServiceClient->listAccessibleCustomers();


When i iterate throw array of customers to have names I get:

foreach ($accessibleCustomers->getResourceNames() as $customerResourceName) {
$customer = CustomerServiceClient::parseName($customerResourceName)['customer'];
$current_customer = $customerServiceClient->getCustomer(ResourceNames::forCustomer($customer));
$name = $current_customer->getDescriptiveName();
$result = [
'name' => $name,
'id' => intval($customer)
];
array_push($accessibleCustomerIds, $result);
}
Exception:
{
  "message": "The caller does not have permission",
  "code": 7,
  "status": "PERMISSION_DENIED",
  "details": [
    {
      "@type": "google.ads.googleads.v5.errors.googleadsfailure-bin",
      "data": "<Unknown Binary Data>"
    },
    {
      "@type": "grpc-status-details-bin",
      "data": "<Unknown Binary Data>"
    },
    {
      "@type": "request-id",
      "data": "51xDV-nU3NsoLzScC1bU5g"
    }
  ]
}

Is it somehow related to the developer token? If so, how to get access. Thank.

Google Ads API Forum Advisor Prod

unread,
Feb 1, 2021, 1:29:55 PM2/1/21
to demchenko...@gmail.com, adwor...@googlegroups.com
Hello,

The full error message mentions the "login-customer-id" header, and that's likely the cause of this issue. You should specify the login customer ID to match the account that you're making the request on and then, assuming you have access to that customer, the error should no longer appear.

Regards,
Mike, Google Ads API Team

ref:_00D1U1174p._5004Q2Bc0N7:ref
Reply all
Reply to author
Forward
0 new messages