Search code examples
google-apps-scriptweb-applicationspermissionsgoogle-oauthhttp-status-code-400

Facing issue with authorizing a Google Script I created


I have created a Google Scripts project that helps me manage my emails via labels and archiving. Through the interface at https://script.google.com/ I created an automatic trigger which worked like a charm for years! But it suddenly stopped working, and is now asking me to "authorize it".

When I click "Review Permissions" I land on a Authorization Error screen saying:

Error 400: policy_enforced

Request Details
access_type=offline
[email protected]
hl=en_GB
response_type=none gsession
redirect_uri=https://script.google.com/oauthcallback
state=3722022919321157632
client_id=25559023822-v3uagu5v2htlkk4nepkpuqpkeh9ncnbm.apps.googleusercontent.com
prompt=consent
scope=https://mail.google.com/

I want to specify I do not own a Google Suite account, and therefore I cannot log into admin.google.com

Any help very much appreciated.

Attachment: screenshot of the popup error window


Solution

  • As @Iamblichus suggested, This is documented in the FAQ:

    Apps Script may be blocked

    If you're enrolled in Advanced Protection, Apps Script can be used. If scripts request access to certain data in your account, like emails, documents, or photos, they may be blocked.