0
以下是函數調用和函數,它可以幫助從Google文檔獲得Google Apps腳本中的oAuth1授權,但隨着oAuth1從4月20日起停止,oAuth2的替換代碼很難找。 請幫我一樣。oAuth2代碼替換Google文檔中的oAuth1
var auth = googleOAuth_('docs',scope);
function googleOAuth_(name,scope)
{
var oAuthConfig = UrlFetchApp.addOAuthService(name);
oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
oAuthConfig.setConsumerKey("anonymous");
oAuthConfig.setConsumerSecret("anonymous");
return {oAuthServiceName:name, oAuthUseToken:"always"};
}
顯示確切範圍url – 2015-04-04 14:12:14
請參閱此安anser:[GitHub Apps腳本OAuth2](http://stackoverflow.com/a/29441609/2946873) – 2015-04-04 14:38:36