问题
Is it possible to make sure that users are not presented with an Authorize dialog when integrating a Google apps script on a google site? when the site is only exposed internally?
回答1:
As mentioned, there are two use cases primarily supported by Apps Script native Apps beans:
- Execute as deploying user: end users don't need to authorize since accesses deployer's Apps resources
- Execute as end user: end users need to authorize since accesses end user's Apps resources
The third use case you're describing is supported by the Apps Script's URLFetchApp running against the Google Apps APIs.
In many cases the Apps APIs can perform operations on behalf of the user which the authorized client (in this case Apps Script) has authority to perform, so if the client is authorized with admin credentials, the API can often perform operations on behalf of the end user without the end user having to authorize Apps Script to do so.
Unfortunately for your use case, the Gmail Inbox API doesn't appear to be one of those APIs. For monitoring other end-user inbox information, the Gmail Audit API may meet your needs.
回答2:
If you set your app to execute as the 'user accessing the app', then it is not possible. However, if you set it to run as yourself, then only you have to re-authorize when you make any changes to code. The end users will not be asked to authorize
来源:https://stackoverflow.com/questions/12353172/authorizing-a-google-apps-script