I started quite recently experimenting with web apps, and I am now busy getting them to run across accounts within my organization.
I need to update labels to Gmail emails across these accounts. I trigger my scripts via a get request in the client details spreadsheet, which identifies the email threads in the associated accounts and applies them a label.
For this to work without having to create a web app per account executed as the owner of the account, I imagined that a deployment executed as the user who executes the trigger would just do it. However, doing so results in an html response that seems to be an authorization screen from Google:
Authorization needed
Google Apps Script">
My app name (Unverified)
The developer of My app name, florent@xxx.de, needs your permission to access your data on Google
When reviewing permissions, consider whether you trust
Execution canceled. You may now close the tab/window or reload the page
(‘auth-button-cancel’).onclick = showAuthCancel; document.getElementById(‘auth-button-confirm’).onclick = showAuthPrompt; document.getElementById(‘auth-cancel-link’).onclick = showAuthRequired
It works fine when the app is run as myself, but I’d hate to have to replicate and maintain the project on each account, even though that is a way to achieve the result.
I read a number of articles, but many did not apply to my situation, and others were beyond my current skill to try them all out. I also tried a few things in the cloud console but I am too noob to get my head around it fully.
I use the following oAuth scopes and don’t see what can be missing:
"oauthScopes": [
"[https://www.googleapis.com/auth/script.external_request](https://www.googleapis.com/auth/script.external_request)",
"[https://www.googleapis.com/auth/script.scriptapp](https://www.googleapis.com/auth/script.scriptapp)",
"[https://www.googleapis.com/auth/forms](https://www.googleapis.com/auth/forms)",
"[https://www.googleapis.com/auth/drive.readonly](https://www.googleapis.com/auth/drive.readonly)",
"[https://www.googleapis.com/auth/spreadsheets](https://www.googleapis.com/auth/spreadsheets)",
"[https://www.googleapis.com/auth/userinfo.email](https://www.googleapis.com/auth/userinfo.email)",
"[https://www.googleapis.com/auth/script.external_request](https://www.googleapis.com/auth/script.external_request)",
"[https://www.googleapis.com/auth/gmail.labels](https://www.googleapis.com/auth/gmail.labels)",
"[https://www.googleapis.com/auth/gmail.modify](https://www.googleapis.com/auth/gmail.modify)"
],