Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
185 views
in Technique[技术] by (71.8m points)

"Authorization is required to perform that action" for gmail script

I am trying to write a script that automatically deletes old Gmail email. I have it generally working, but after a few days, I get an email with this error message:

Your script, Batch Delete Gmail, has recently failed to finish successfully. A summary of the failure(s) is shown below. To configure the triggers for this script, or change your setting for receiving future failure notifications, click here.

Start Function Error Message Trigger End

1/25/21 9:41 AM batchDeleteEmail Authorization is required to perform that action. time-based 1/25/21 9:41 AM

I'm trying to document the process here: https://superuser.com/questions/1618156/how-do-i-automatically-delete-old-google-email-gmail

Unfortunately, I don't really know what I'm doing. I have no experience with Google APIs or the Google Cloud Platform. The only reason I got as far as I have is because I got lucky reading a couple web pages and clicking on things until it started working.

I suspect that I have some kind of temporary "user" (or maybe a test user) that has access for a few days but is then automatically revoked. Unfortunately, I can't remember how I created that user.

question from:https://stackoverflow.com/questions/65890822/authorization-is-required-to-perform-that-action-for-gmail-script

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Please, read the relevant Apps Script documentation to learn how to use Apps Script correctly, it has comprehensive guides for begginers like you. Never run code you don't know what is doing as it could be malicious. When copy pasting code always make sure you know what is doing.

Issue:

This is because you added some new code that needs authorization but you never executed the script manually or create the trigger after that point in order to give authorization for the recently added service.

Solutions:

Run the script manually and when the authorization window pops up, authorize the script.

or

Delete and create the time trigger again and again the authorization window will pop up and you can authorize the new service.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...