我想使用Google Ads访问Google Ads报告。作为第一步,我们希望使用GoogleCustomerServiceClient来检索客户信息。
$MMC_ID = <My MMC 10 digits number>;
$credentialsIniPath = app_path('resources/credentials/google/google_ads_php.ini');
$oAuth2Credential = (new OAuth2TokenBuilder())
->fromFile($credentialsIniPath)
->build();
$googleAdsClient = (new GoogleAdsClientBuilder())
->fromFile($credentialsIniPath)
->withOAuth2Credential($oAuth2Credential)
->build();
$customerServiceClient = $googleAdsClient->getCustomerServiceClient();
try {
$customer = $customerServiceClient->getCustomer(ResourceNames::forCustomer($MMC_ID));
} catch(GoogleAdsException $e) {
$this->error($e->getMessage());
}但是它会返回一个错误
Fault
-------
Status code: 7
Details: The caller does not have permission
Failure: {"errors":[{"errorCode":{"authorizationError":"DEVELOPER_TOKEN_NOT_APPROVED"},"message":"The developer token is not approved. Non-approved developer tokens can only be used with test accounts."}]}创建MMC的帐户Oauth2登录是测试帐户。在google_ads_php.ini中,已经填写了clientId、clientSecret、refreshToken和developerToken。刚刚生成了refreshToken。
我应该在这里面检查什么呢?
谢谢。
发布于 2020-08-05 14:44:29
我从这个URL创建了一个新的URL,用于测试。https://adwords.google.com/um/Welcome/?sf=mt
已解决。
https://stackoverflow.com/questions/63259201
复制相似问题