Oauth 2.0 OAuth2和AdWords临时报告身份验证问题

Oauth 2.0 OAuth2和AdWords临时报告身份验证问题,oauth-2.0,google-oauth,google-ads-api,Oauth 2.0,Google Oauth,Google Ads Api,上下文:Windows7、IE10、JScript、GoogleAdwords、OAuth2 我已经使用urn:ietf:wg:oauth:2.0:oob技术生成了一个访问令牌和一个刷新令牌,看起来一切正常。我以这种方式生成的令牌可以很好地用于分析调用。此问题与Adwords调用有关。标题和数据如下所示: Authorization: GoogleLogin auth=ya29.blahblah developerToken: blahblah clientCustomerId: blahbla

上下文:Windows7、IE10、JScript、GoogleAdwords、OAuth2

我已经使用urn:ietf:wg:oauth:2.0:oob技术生成了一个访问令牌和一个刷新令牌,看起来一切正常。我以这种方式生成的令牌可以很好地用于分析调用。此问题与Adwords调用有关。标题和数据如下所示:

Authorization: GoogleLogin auth=ya29.blahblah
developerToken: blahblah
clientCustomerId: blahblah
returnMoneyInMicros: false
Content-Type: application/x-www-form-urlencoded

__rdxml=<reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201309"> <selector> <fields>CampaignId</fields> <fields>Id</fields> <fields>Impressions</fields> <fields>Clicks</fields> <fields>Cost</fields> <predicates> <field>Status</field> <operator>IN</operator> <values>ENABLED</values> <values>PAUSED</values> </predicates> </selector> <reportName>Custom Adgroup Performance Report</reportName> <reportType>ADGROUP_PERFORMANCE_REPORT</reportType> <dateRangeType>LAST_7_DAYS</dateRangeType> <downloadFormat>CSV</downloadFormat> </reportDefinition>

我现在越来越

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<reportDownloadError>
<ApiError>
<type>AuthenticationError.OAUTH_TOKEN_INVALID</type>
<trigger>&lt;null&gt;</trigger>
<fieldPath></fieldPath>
</ApiError>
</reportDownloadError>
也指非MCC账户

适用于Mikeys4u

function OAuthConnect(client_id, scope, login_hint) {
  var url = XMAP("https://accounts.google.com/o/oauth2/auth?[1]&[2]&[3]&[4]&[5]&[6]",
      "response_type=code",
      "client_id=" + client_id,
      "redirect_uri=" + "urn:ietf:wg:oauth:2.0:oob",
      "scope=" + escape(scope),
      "state=acit",
      "login_hint=" + login_hint);

  var oIE = new ActiveXObject("InternetExplorer.Application");
  oIE.Visible = true;
  oIE.Navigate(url);
  while (oIE.busy) {
    WScript.Sleep(10);
  };
  var status = oIE.Document.title;
  while (status.indexOf("state=acit") === -1) {
    WScript.Sleep(100);
    status = oIE.Document.title;
  }
  // WScript.Echo(status);
  oIE.Quit();
  var code = RightOf(status, "&code=");
  return code;
}
这是指很多帮助程序代码(比如XMAP和RightOf),但是您应该能够理解其中的大意

该代码的调用看起来像

if (accessToken === "") {
  code = OAuthConnect(secrets.client_id, oCFG.retrieve(client + ".scope"), oCFG.retrieve(client + ".login_hint"));

顺便说一句,这是JScript。

正确的作用域有多大的不同,真是令人惊讶。你现在可以发布完整的代码,因为你不确定作用域是什么意思吗?谢谢你,但我正在使用PHP并尝试临时的方法…似乎什么都做不到。需要找到我的ya.29xxxxxxx令牌,我正在使用刷新令牌。。。。。
https://adwords.google.com/api/adwords/
function OAuthConnect(client_id, scope, login_hint) {
  var url = XMAP("https://accounts.google.com/o/oauth2/auth?[1]&[2]&[3]&[4]&[5]&[6]",
      "response_type=code",
      "client_id=" + client_id,
      "redirect_uri=" + "urn:ietf:wg:oauth:2.0:oob",
      "scope=" + escape(scope),
      "state=acit",
      "login_hint=" + login_hint);

  var oIE = new ActiveXObject("InternetExplorer.Application");
  oIE.Visible = true;
  oIE.Navigate(url);
  while (oIE.busy) {
    WScript.Sleep(10);
  };
  var status = oIE.Document.title;
  while (status.indexOf("state=acit") === -1) {
    WScript.Sleep(100);
    status = oIE.Document.title;
  }
  // WScript.Echo(status);
  oIE.Quit();
  var code = RightOf(status, "&code=");
  return code;
}
if (accessToken === "") {
  code = OAuthConnect(secrets.client_id, oCFG.retrieve(client + ".scope"), oCFG.retrieve(client + ".login_hint"));