Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
whar是google apps转销商api的oauth服务名称_Oauth_Google Apps Script_Google Reseller Api_Service Name - Fatal编程技术网

whar是google apps转销商api的oauth服务名称

whar是google apps转销商api的oauth服务名称,oauth,google-apps-script,google-reseller-api,service-name,Oauth,Google Apps Script,Google Reseller Api,Service Name,我尝试将google apps转销商api与google apps脚本一起使用。要使用oauth,我需要AuthServiceName。正确的名字是什么?“应用程序”不起作用。您的应用程序中定义了AuthServiceName,它不依赖于您连接到的API,我怀疑您可能没有完成所有必要的步骤,或者您的oauth调用结构不正确 下面是一个检索域详细信息的调用示例 function getCustomer() { //set up oauth for Google Reseller API v

我尝试将google apps转销商api与google apps脚本一起使用。要使用oauth,我需要AuthServiceName。正确的名字是什么?“应用程序”不起作用。

您的应用程序中定义了AuthServiceName,它不依赖于您连接到的API,我怀疑您可能没有完成所有必要的步骤,或者您的oauth调用结构不正确

下面是一个检索域详细信息的调用示例

function getCustomer() {
  //set up oauth for Google Reseller API
  var oAuthConfig1 = UrlFetchApp.addOAuthService("doesNotMatter");
  oAuthConfig1.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope=https://www.googleapis.com/auth/apps.order.readonly");
  oAuthConfig1.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
  oAuthConfig1.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken?oauth_callback=https://script.google.com/a/macros");
  oAuthConfig1.setConsumerKey(CONSUMER_KEY);
  oAuthConfig1.setConsumerSecret(CONSUMER_SECRET);

  var options1 = {oAuthServiceName:"doesNotMatter", oAuthUseToken:"always", 
                  method:"GET", headers:{"GData-Version":"3.0"}, contentType:"application/x-www-form-urlencoded"};

  //set up user profiles url
  var theUrl = "https://www.googleapis.com/apps/reseller/v1/customers/somedomain.com";  

  //urlFetch for customer list
  var customerInfo = "";

  try {
    var response = UrlFetchApp.fetch(theUrl,options1);
    customerInfo = response.getContentText();
  } catch(problem) {
    Logger.log(problem.message);  
  }

  Logger.log(customerInfo);

}
如果

  • 您有一个经销商帐户(我猜,即我没有在我的非经销商帐户上进行测试)
  • 您已经在API控制台中创建了一个项目,并启用了分销商API
  • 你知道你的秘密和钥匙是从控制台拿出来的
  • 我使用了一个安全的只读范围,如果没有,你需要在沙盒中设置你的测试

  • 如果您需要进一步澄清,请告诉我

    非常感谢。我尝试使用“匿名”作为秘密和密钥,但出现了“usageLimits”错误。因此,使用特定的秘密和密钥似乎更好。如何在康科莱买一个?我需要域密钥和密码吗?如何获取密钥?您需要了解的关于API控制台的所有信息都在这里:非常感谢。。。我在您的脚本代码中使用了我的机密和密钥,但出现了以下错误:值oAuthServiceName错误。。。