1

我正在尝试运行以下代码:

var oAuthConfig = UrlFetchApp.addOAuthService("name");
oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope=https://www.googleapis.com/auth/admin.directory.user");
oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
oAuthConfig.setConsumerKey("******************");
oAuthConfig.setConsumerSecret("******************");


 var options =
     {
         "oAuthServiceName" : "name",
         "oAuthUseToken" : "always",
     };


 var result = UrlFetchApp.fetch("https://www.googleapis.com/admin/directory/v1/users?domain=******************&maxResults=2",options);

}

我确定我使用的是“密钥”和“消费者密钥”。

错误是:

{
 "error": {
 "errors": [
 {
 "domain": "usageLimits",
 "reason": "dailyLimitExceededUnreg",
 "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
 "extendedHelp": "https://code.google.com/apis/console" }
 ]
,
 "code": 403,
 "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup." }
 }

谁知道怎么修它?

4

1 回答 1

2

您需要在 UrlFetchApp.fetch 中将 Auth Token 作为参数发送。由于您没有发送它,因此发送了未经身份验证的消息。

于 2013-06-10T18:41:43.110 回答