首页 文章

Google AdWords API AuthorizationError.SERVICE_ACCESS_DENIED

提问于
浏览
0

我正在尝试向Google AdWords API发出任何请求,这将返回非错误 .

An error has occurred: [AuthorizationError.SERVICE_ACCESS_DENIED @ ]

我使用开发人员令牌生成MCC帐户,此外我还在测试帐户中在Google开发者控制台中创建了测试MCC帐户和OAuth2应用 .

另外我已经使用不同的帐户( 生产环境 MCC,测试MCC,启用了adwords的用户,没有adwords的用户)对已经提出请求的auth app / user进行了测试

身份验证

适用于任何设置/不同客户端,完美无瑕 . 我正在获取access_token,refresh_token和expires .

以下是auth url的示例,googleads-php-lib生成

https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=XXXX&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fadwords&access_type=offline

API请求

我正在使用googleads-php-lib / examples和curl进行查询 . 我也尝试过不同的服务

这是 googleads-php-lib/examples/AdWords/Auth/CreateAdWordsUserWithoutIniFile.php 的片段

$customerService = $user->GetService("CustomerService");
$customer = $customerService->get();
printf("You are logged in as customer: %s\n", $customer->customerId);

更详细的错误日志

[Jul 22 2015 17:58:57.000000 - ERROR] effectiveUser= service=CustomerService method=get operators={} responseTime=233 requestId=00051b757ec645820ac2a364d90c7911 operations=0 units= server=a dwords.google.com isFault=true faultMessage= [AuthorizationError.SERVICE_ACCESS_DENIED @ ]

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201506" xmlns="https://adwords.google.com/api/adwords/mcm/v201506">
     <ns2:requestId>00051b848d9382a80ac219c38e02d5f3</ns2:requestId>
   <ns2:serviceName>CustomerService</ns2:serviceName>
   <ns2:methodName>get</ns2:methodName>
   <ns2:operations>0</ns2:operations>
   <ns2:responseTime>466</ns2:responseTime>
 </ResponseHeader>
 </soap:Header>
 <soap:Body>
   <soap:Fault>
     <faultcode>soap:Server</faultcode>
     <faultstring>[AuthorizationError.SERVICE_ACCESS_DENIED @ ]</faultstring>
     <detail>
       <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/mcm/v201506" xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201506">
         <ns2:message>[AuthorizationError.SERVICE_ACCESS_DENIED @ ]</ns2:message>
        <ns2:ApplicationException.Type>ApiException</ns2:ApplicationException.Type>
          <ns2:errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:AuthorizationError">
         <ns2:fieldPath/>
         <ns2:trigger/>
         <ns2:errorString>AuthorizationError.SERVICE_ACCESS_DENIED</ns2:errorString>
         <ns2:ApiError.Type>AuthorizationError</ns2:ApiError.Type>
         <ns2:reason>SERVICE_ACCESS_DENIED</ns2:reason>
       </ns2:errors>
     </ApiExceptionFault>
   </detail>
 </soap:Fault>

结论

通常API确实有效,因为我收到了故意不良凭据的不同错误 . 例如

AuthenticationError.NOT_ADS_USER

要么

AuthorizationError.USER_PERMISSION_DENIED
  • 我应该从哪个帐户登录进行测试?

  • 应从哪个帐户创建OAuth2应用程序?

  • 这个案例的范围是否足够_2633997? AdWords还有更多范围吗?

感觉我错过了一些合乎逻辑的步骤,也许谷歌应该为我批准它,还是我需要发誓庄严地向北方寻找?

对任何想法都非常感激 .

1 回答

  • 0

    原来,谷歌只允许 生产环境 MCC的特定服务,我没有测试过 .

    对于AdWords用户来说,这不应该是一个问题,因为此案例特定于我的MCC .

相关问题