hi

21 views
Skip to first unread message

Jaya prakash

unread,
Aug 6, 2026, 5:38:31 AM (6 days ago) Aug 6
to Google Apps Script Community
  I created a brand new Apps Script project using script.new. Running even DriveApp.getFiles() or UrlFetchApp.fetch() shows "Authorization required", but after clicking "Review permissions" it immediately redirects to "This app is blocked". This happens on multiple PCs, multiple browsers, Incognito mode, and different Google accounts. The OAuth client ID shown is 237171130688-f81v469u3nvljoh2sbon22h7kv4b9t9v.apps.googleusercontent.com

Andrew Apell

unread,
Aug 6, 2026, 6:10:11 AM (6 days ago) Aug 6
to Google Apps Script Community
This error happens because Google has triggered a high-risk OAuth security block. DriveApp and UrlFetchApp require sensitive/restricted scopes, which Google automatically blocks if your script is linked to an unverified Google Cloud Platform (GCP) project or blocked by a Google Workspace domain policy.

Solution 1: Personal Gmail Accounts (@gmail.com)
If your script is attached to a custom GCP project, Google blocks authorization unless your account is listed as a test user or you revert to the default project.

Add yourself as a Test User (if using a custom GCP project):
  1. Open the Google Cloud Console for your project
  2. Navigate to APIs & Services > OAuth consent screen.
  3. Scroll down to Test users and click + ADD USERS.
  4. Enter your Gmail address and click Save.
  5. Re-run your Apps Script function and authorize again.
Revert to Default GCP Project (easiest fix):
  1. Open your Apps Script project.
  2. Click Project Settings (gear icon on the left menu).
  3. Under Google Cloud Platform (GCP) Project, click Change project.
  4. Set it back to the default project number if you manually linked an external GCP project without completing OAuth consent configuration.

Solution 2: Google Workspace Accounts (Work or School)
Google Workspace administrators often enforce strict API security policies that block unverified apps requesting sensitive scopes.

Option A: Mark the App as Trusted (Workspace Admin required)
  1. Go to the Google Admin Console.
  2. Navigate to Security > Access and data control > API controls.
  3. Select Manage Third-Party App Access.
  4. Click Add App > OAuth App Name or Client ID.
  5. Paste your Apps Script's OAuth Client ID (found in your GCP Console or project settings) and set its status to Trusted.
Option B: Restrict Scopes in appsscript.json
  1. In Apps Script, click Project Settings (gear icon) and check Show "appsscript.json" manifest file in editor
  2. Click appsscript.json in the file tree.
  3. Define explicit, minimal scopes in the oauthScopes array so Google doesn't automatically grant broad read/write access.ON

Courtesy of Gemini
G
Reply all
Reply to author
Forward
0 new messages