I have looked at the answer here: How do I stop the error, Authorisation is required to perform that action in Google Script . This doesn't not solve my problem because I didn't change any of my code and I already have authorized the code the first time I ran it. All of a sudden I get the Authorization is required to perform that action
error.
I have also tried this link https://developers.google.com/apps-script/troubleshooting#common_errors and ran a blank function in the editor function test() { var a=1}
. This runs ok without giving me a prompt to authorize the script and with no errors. So after following Google's instructions: To authorize the script, open the Script Editor and run any function.
I'm still getting the Authorization is required to perform that action
error.
I'm not doing anything fancy. The script has only one .gs
file, and the file only has one function. I'm not using any advanced services and I'm not linking it to any libraries.
Update: I've tried to make a copy of the file, and I then go into script editor again to run the code. This time the authorization pop is there, so I click on continue. The follow shows up: the code would like to
View and manage the files in your Google Drive.
Send email as you
Connect to an external service
I click on "Accept". The code starts to run, 2 seconds later Authorization is required to perform that action.
Now every time I try running the code, it doesn't even give me the authorization pop up. It just gives me the error.
here is the oauth part of the code. The rest of the code is just a few more lines more.
var oauthConfig = UrlFetchApp.addOAuthService("google");
var scope = "https://docs.google.com/feeds/";
//make OAuth connection
oauthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
oauthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
oauthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
oauthConfig.setConsumerKey("anonymous");
oauthConfig.setConsumerSecret("anonymous");
//get request
var request = {
"method": "GET",
"oAuthServiceName": "google",
"oAuthUseToken": "always",
"muteHttpExceptions": true
};