Following is function call and function which helps in oAuth1 in Google Apps Script for Authorization from google Docs but as oAuth1 is getting discontinue from 20 April 15, replacement code for oAuth2 is hard to find. Please help me for same.
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"};
}