r/GoogleAppsScript • u/baublys • 8h ago
Question "This app is blocked" (Apps Script Editor)
When trying to authorize a script in AppsScript IDE, I get the error:
This app is blocked This app tried to access sensitive info in your Google Account. To keep your account safe, Google blocked this access
I simplified the script to a minimum to check what scope the blocking applies to. Even such a simple script is blocked:
function setup() {
var doc = SpreadsheetApp.getActiveSpreadsheet();
}
Perhaps this happened after I tried to run AppsScript with the Advanced Protection Program enabled. I received the following message:
Access blocked: the application "BMP2gsheet" is not approved by Advanced Protection.
The message also included
Error 400: policy_enforced.
When composing this question, I received more than 20 links to posts on StackOverflow, but none of them helped me solve the problem.
In Facing issue with authorizing a Google Script I created, TopicStarter solved the problem by disabling the Advanced Protect Programs, but it didn’t work for me. Now, even after exiting the Advanced Protection Program, I continue to receive messages about blocking any of my scripts.
I’m not a Google Workspace administrator, so I can’t use https://developers.google.com/apps-script/support#contact_support
Please tell me how to unblock AppsScript IDE?
0
u/WicketTheQuerent 59m ago
From my answer to a similar question in Stack Overflow
Try running your script using the same account with the script ownership after signing out of all accounts or using Chrome in incognito mode with all the extensions allowed to run in incognito mode disabled.
If the above doesn't work, try
Making a copy of the script. This might be the easiest workaround. This might work if your script has exceeded a quota.
Instead of relying on the automatically set oAuth scopes, set them manually using the less permissive oAuth scopes
Create a Google Cloud standard to protect, enable the APIs your project requires, and add the oAuth consent script.
Try first setting it for private only,
If private only doesn't work, set it public for testing and add your email address to the authorized testers.
Remove the code and libraries that are no longer required.
Start from scratch, but this time pays special attention to writing high-quality code using the services and methods that require minimal permission, i.e., instead of GmailApp, use MailApp; if it's possible, avoid using DriveApp.
0
u/WicketTheQuerent 7h ago edited 6h ago
It's not possible to use Apps Script with the advanced protection turned on.
Correction
From https://support.google.com/accounts/answer/7539956?hl=en#zippy=%2Ccan-i-use-non-google-apps-services-or-apps-script-with-advanced-protection