2
我想通过Apps脚本使用电子邮件设置API来管理Google网站上的所有用户签名。我之前使用Documents Data API进行双腿OAuth并且工作得很好。我目前卡在电子邮件设置API的身份验证步骤。电子邮件设置API身份验证
代码例如:
// Setup OAuthServiceConfig
var oAuthConfig = UrlFetchApp.addOAuthService("signature");
oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken");
//I left scope empty to gain access to all APIs would this scope work scope=https://apps-apis.google.com/a/feeds/emailsettings/2.0/
oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
oAuthConfig.setConsumerKey("domain.com");
oAuthConfig.setConsumerSecret("consumerSecret");
// Setup optional parameters to point request at OAuthConfigService. The "signature"
// value matches the argument to "addOAuthService" above.
var options =
{
"method" : method,
"oAuthServiceName" : "signature",
"oAuthUseToken" : "always"
};
var result = UrlFetchApp.fetch("https://apps-apis.google.com/a/feeds/emailsettings/2.0/"+domainName+"/"+userName+"/signature", options);
Logger.log(result);
我得到这个错误: “意外的错误(线37)”,它是 VAR结果= UrlFetchApp.fetch(“https://apps-apis.google.com/ a/feeds/emailsettings/2.0 /“+ domainName +”/“+ userName +”/ signature“,options);
对我在做什么有什么想法吗?
作用域在这里:http://support.google.com/a/bin/answer.py?hl=en&answer=162105