Important: You must have an Enterprise, Education Standard, or Education Plus Google Workspace account to monitor and restrict the data access that users grant to Apps Script.
Google Workspace users grant access to levels of data, known as scopes, when they run scripts or use apps like add-ons or web apps. This page explains how you can monitor or revoke the scopes that users grant access to within their Google Workspace account.
Monitor OAuth grant events by scope
To view events where users grant access to a specific scope or scopes, take the following steps:
In the Google Admin console, go to Menu > Security > Security center > Investigation tool.
Click Data Source and select OAuth log events.
Click Add condition > Attribute and select Event.
Click Event and select Grant.
Click Add condition > Attribute and select Scope.
For Scope, enter the scope you want to monitor. For a list of scopes, refer to OAuth 2.0 Scopes for Google APIs.
Click Search. A list of grant events displays for the scopes you specified.
Revoke OAuth grants
Important: After you revoke access to a scope, users can re-grant access. We recommend that you set up alerts for scopes that you don't want users to grant access to so that you can revoke access as needed. Refer to Create an alert for OAuth grants.
To revoke access to a scope, follow the steps for Monitor Oauth grant events by scope, then select the events you want to revoke and click Revoke access tokens for users.
Create an alert for OAuth grants
To receive an alert when someone grants access to a specific scope, follow the steps for Monitor Oauth grant events by scope, then take the following steps:
- At the top of the search, click Create activity rule.
- For Rule name, enter a name for the alert.
- Click Next: View Conditions. The conditions automatically populate from the search parameters. You can edit them if needed, then click Next: Add Actions.
- In Threshold 1, select a time frame and threshold for the rule and check the Send to alert center box.
- Click Add email recipients and enter the email addresses that should receive alerts. Click Done.
- Click Next: Review.
- Review the details and click Create Rule
For more information, refer to Create and manage activity rules.